开发者

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

开发者 https://www.devze.com 2023-02-15 06:01 出处:网络
So I\'ve been starting DS programming, and I notice that to draw a pixel the c开发者_如何转开发olor must be a RGB(0, 31, 0). Is there any way to change that to something like RGB(0, 255, 0)?If you hav

So I've been starting DS programming, and I notice that to draw a pixel the c开发者_如何转开发olor 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号