thanks for your attention.
GAPI: one colour mode:kfDirect565, it means red:5 bits, green:6 bits, blue: 5 bits. so I wrote some codes as following:
[C]
but one day, I saw another codes at www.microsoft.com, following:
[C#]
who can tell me that which one is right? and why?
thank you again.
GAPI: one colour mode:kfDirect565, it means red:5 bits, green:6 bits, blue: 5 bits. so I wrote some codes as following:
[C]
- Code:
#define MAKE_RGB_565( r, g, b ) (((r & 0x1f) << 11) | ((g & 0x3f) << 5) | (b & 0x1f))
but one day, I saw another codes at www.microsoft.com, following:
[C#]
- Code:
public static ushort BGRToPixel565(byte blue, byte green, byte red)
{
return (ushort)((((ushort)red >> 3) << 11) |
(((ushort)green >> 2) << 5) | ((ushort)blue >> 3));
}
who can tell me that which one is right? and why?
thank you again.