5 bit RGB (0, 31, 0) to 16 bit RGB (0, 255, 0)

So, I started programming DS, and I noticed that to draw a pixel, the color must be RGB (0, 31, 0). Is there a way to change this to something like RGB (0, 255, 0)?

+3
source share
2 answers

5 bit rgb : 31 = 8 bit rgb : 255

so 8 bit rgb = (5 bit rgb * 255 / 31)

Example:

5 bit RGB = 12,3,21

8 bit R = (12 * 255) / 31 = 99
      G = (3 * 255) / 31  = 25
      B = (21 * 255) / 31 = 172

PS: I think you mean "5 bit RGB to 8 bit RGB" in your title.

+3
source

If you have a green value gwith a range of 0-255, you can convert it to a NintendoDS range of 0-31 using g*31/255. If you ask us if you can actually do something so that your NintendoDS displays a range of 0-255 for each channel, there is no answer, but you can use anti-aliasing (search engine).

+4

Source: https://habr.com/ru/post/1796599/


All Articles