简体   繁体   English

5位RGB(0,31,0)至16位RGB(0,255,0)

[英]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). 所以我一直在开始DS编程,我注意到要绘制一个像素,颜色必须是RGB(0,31,0)。 Is there any way to change that to something like RGB(0, 255, 0)? 有没有办法将其更改为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 . 如果您的绿色值g的范围为0-255,则可以使用g*31/255 31/255将其转换为NintendoDS的0-31范围。 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). 如果你问我们你是否真的可以做一些事情让你的NintendoDS显示每个频道的范围为0-255,答案是否定的, 你可以使用抖动(搜索引擎)。

5 bit rgb : 31 = 8 bit rgb : 255

so 8 bit rgb = (5 bit rgb * 255 / 31) 所以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. PS:我认为你的标题是“5位RGB到8位 RGB”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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