简体   繁体   中英

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

So I've been starting DS programming, and I notice that to draw a pixel the color must be a RGB(0, 31, 0). Is there any way to change that to something like RGB(0, 255, 0)?

If you have a green-value g with a range of 0-255, you can convert it to NintendoDS's 0-31 range by using g*31/255 . If you are asking us if you can actually do something to make your NintendoDS display a range of 0-255 for each channel the answer is no, but you could use dithering (search-engine it).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM