I am trying to create ARGB pixel, I have seen this example:
int createPixel(int r, int g, int b, int a)
{
return (a<<24) | (r<<16) | (g<<8) | (b<<0);
}
For understanding I would like get answers to this questions:
<<
is binary shift left, this means a will be shifted 24 bits to the left, red 16,...
you get an 4byte integer as result, first byte is a (because shifted 24 bits (3Bytes) to the left), second byte is r, third is g, fourth b.
resulting 0xaarrggbb
example input (255,255,0,16)
returns 0xFFFF000F
0x stands for "in hex format"
|
is a bitwise or.