The data rendered of imgui within window get a lighter color - vulkan

The data rendered outside the window get a correct color
The data rendered within the window get a lighter color
As the images described, does anyone know what caused the problem?

The reason for the color lighter is that sRGB has a higher range of color space.
The problem above was caused by the that Dear Imgui uses VK_FORMAT_R8G8B8A8_UNORM as the highest priority to create the Swapchain, but I use 'VK_FORMAT_R8G8B8A8_SRGB` for my purpose.
To get the problem resolved. You could choose the two methods below.
Use the VK_FORMAT_R8G8B8A8_UNORM to create your Swapchain as what Dear Imgui used in the backends/impl_vulkan.
Or you could change the priority list to select the VK_FORMAT_R8G8B8A8_SRGB in the backends/impl_vulkan like what I did:backends/impl_vulkan: set VK_FORMAT_R8G8B8A8_SRGB as default

Related

Since React Native uses pixels or percentages for units, how do we handle accessibility of larger text for input

Since React Native uses only pixels or percentages for units, how do we handle accessibility of larger text?
I know I can disable font scaling, but that is what I specifically do not want to do.
I am asking specifically for TextInput since there are other parts of the screen which won't change even if you scale up like the bottom nav bar. Because say we set a widget for time input on the browser we can say 5em to limit it to 5 character sizes regardless of the size of the text.
One way I can think of is to use * 16 in place of em but that does not work when you scale up the font since 16 is fixed.
Also I am looking for something that works in Expo. AccessibilityInfo does not appear to provide the size and I can't find any information on accessing the value of Dynamic Type
My crazy idea at the moment is to have a transparent Text that I has an onLayout and I obtain the size of the component and set it in a context that all my custom TextInput will use as a measurement that has a size based on number of characters.
react-native-elements is utilizing a helper function called normalize for font scaling which is implemented as follows.
import { moderateScale } from 'react-native-size-matters';
function normalize(number, factor = 0.25) {
return moderateScale(number, factor);
}
export default normalize
I'm currently using react-native-size-matters on developing UIs for multiple devices along with above font scaling by react-native-elements. Works fine in almost all the time.
Check out the react-native-size-matters repo is you have doubts on the implementation. Author has a good article written on explaining his approach as well.
PixelRatio.getFontScale() allows you to get the font scale that adjusts its number based on the user's choice of dynamic type.
The number you can use as a multiplier on the widths to increase or decrease depending on the font size if a dynamic font size is used.
One thing to note though, changing the size does not trigger a re-render unlike useColorScheme() since there's no context provided that has this information.

A way to keep colors in black&white picture when changing image mode from index color to greyscale?

I took pics like these
The files generated form the camera are bmp.
Problem is i need to load them in a certain program where i noticed works only when in photoshop i go to modes -> greyscale. The images are originally indexed color or RGB Color (which i used to make some adjustments - but end results is like u see in these pictures). But when i change mode to greyscale I notice the pics changing (though not sure because i mainly use the mean value from histogram to measure various areas with the square marquee tool -the mean value changes at around 10 points, but again unsure if i should be using that one or if there is some other way to measure the average value of a color in an area). But the image should remain same since its black&white right?

Positioning items dynamically for different screensizes

Good morning!
I'm currently trying to create a view similar to this mockup.
I have put down 3 different screen sizes so you can see the issue.
I have a header background image (grey box) with an angled bottom. On the right I want to display an image, which obviously needs to be positioned.
Positioning it horizontally is no issue but how can I position the image vertically? I have it positioned fixed for one screen size but obviously need to make it flexible.
Any ideas? Help would be much appreciated!
David
You can definitely use measure as #rajesh pointed out, or you can use Dimensions. As far as getting the layout consistent across devices, using position absolute and measuring the device height should allow you to get consistency across these devices.
Check out this example I set up, it should be a good starting point at least.
https://rnplay.org/apps/pSzCKg

three.js: how to control rendering order

Am using three.js
How can I control the rendering order? Let's say I have three plane geometries, and want to render them in a specific order regardless of their spatial position.
thanks
You can set
renderer.sortObjects = false;
and the objects will be rendered in the order they were added to the scene.
Alternatively, you can leave sortObjects as true, the default, and specify for each object a value for object.renderOrder.
For more detail, see Transparent objects in Threejs
Another thing you can do is use the approach described here: How to change the zOrder of object with Threejs?
three.js r.71
for threejs r70 and higher is renderDepth removed.
Using object.renderDepth worked in my case. I had a glass case and bubbles inside that were transparent. The bubbles were getting lost at certain angles.
So, setting their renderDepth to a high number and playing with other elements depths in the scene fixed the issue. Hooking up a dat.gui control to the renderDepth property made it very easy to tweak what needed to be at what depth to make the scene work.
So, in my fishScene, I have gravel, tank and bubbles. I hooked up the gravel mesh with a dat.gui control and with in a few seconds, I had the depth I needed.
this.gui.add(this.fishScene.gravel, "renderDepth", 0, 200);
i had a bunch of objects which was cloned from a for loop in random position x and y... and obj.z ++, so they would line up in line.. including obj.renderOrder ++; in the loop solved my issue.

custom colors in bing maps?

I was looking at http://www.msnbc.msn.com/id/26295161/ns/weather/ and noticed that the flash map is provided by bing and have a custom color scheme. I have a similar need to show maps with a black & white colortheme, is it possible using their api or have they made custom tiles ? (doesnt seem feasible to provide tiles for alls maps on all levels :)
If you are not wedded to Bing maps, you could look into Mapbox, which provide maps based on OpenStreetMap in any style that you desire.
This question is still not answered and even if it's kind of old, I think it matters.
In fact, they're not using different tiles or a custom tile scheme. You can see those in the network inspection tool.
Since they're inside a Flash application, they can easily change the color of the image using filter on image (ColorMatrixFilter) and changing dynamically on the client side the rendered colors.
Well now some years later you can: https://msdn.microsoft.com/en-us/library/mt823636.aspx :-)
(I got here by looking for some sample styles and thought I add the link for anybody else finding this question)
Perhaps a custom tile skinner is that you need: http://rbrundritt.wordpress.com/2009/11/27/bing-maps-custom-tile-skinner/
In this example, the author changes the color of roads using ColorMatrix and ColorMap:
The two key methods used to transform the colors
consist of using ColorMatrix or a ColorMap. By
using a color matrix all the colors on the tile
can be changed within a couple lines of code. Using
a ColorMap allows you to change one color at a
time. This is useful if you only want to change a
few colors on the map.