Short to 16bit 555 format
Hi,
I have a file which I read in shorts. Each short represents a color.
I need to make the short into a RGB color using 555 format.
F = Alpha
Red = E to A
Green = 9 to 5
Blue = 4 to 0.
So I made the function
Code:
public Color getColor(short value)
{
short R = (value & 0xF800) >> 10;
short G = (value & 0x07C0) >> 5;
short B = (value & 0x003E);
return Color.FromArgb(R, G, B);
}
The error I get is:
Error 1 Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?)
On each of the conversions. I looked this up in a couple places and it said almost the same thing, can anyone help me?
Thankyou.