Update
This commit is contained in:
parent
76e9db8a4c
commit
910eefc063
23 changed files with 2340 additions and 2120 deletions
|
@ -4,6 +4,8 @@ RGB565 is [color](color.md) format, or a way of representing color with just 2 [
|
|||
|
||||
Yet another similar format to this one is [RGB555](rgb555.md) which sacrifices one useful bit for gaining the nice property of having the same size of each component. The one "wasted" bit may also be utilized, e.g. for marking transparency. Variants of RGB565 can also be obtained by [swapping](permutation.md) the order of components, e.g. BGR565 etc.
|
||||
|
||||
It would also be possible (but more complex) to use a different color model than [RGB](rgb.md), for example [HSV](hsv.md) or [HSL](hsl.md). In this case 6 bits should probably be allocated for the value (lightness) component, as human sight is more sensitive to this color component. However this would somehow have to address the issue of some colors (such as black) having multiple possible representations.
|
||||
|
||||
Here is a [C](c.md) code for the basic conversions to/from RGB565:
|
||||
|
||||
```
|
||||
|
@ -28,5 +30,4 @@ void rgbFrom565(unsigned int colorIndex, unsigned char *red,
|
|||
}
|
||||
```
|
||||
|
||||
There exist nice tricks you can do with colors represented this way, like quickly divide all three R, G and B components by a power of two just by doing one bit shift and logical [AND](and.md) to zero the highest bits of the components, or approximating addition of colors with logical [OR](or.md) and so on -- for details see the article on [RGB332](rgb332.md).
|
||||
|
||||
There exist nice tricks you can do with colors represented this way, like quickly divide all three R, G and B components by a power of two just by doing one bit shift and logical [AND](and.md) to zero the highest bits of the components, or approximating addition of colors with logical [OR](or.md) and so on -- for details see the article on [RGB332](rgb332.md).
|
Loading…
Add table
Add a link
Reference in a new issue