How to create an ARGB_8888 pixel value?
- by vidstige
Say I want to create an array of pixel values to pass into the createBitmap method described here. I have three int values r, g, b in the range 0 - 0xff. How do I transform those into a opaque pixel p?
Does the alpha channel go in the high byte or the low byte?
I googled up the documentation but it only states that:
Each pixel is stored on 4 bytes. Each channel (RGB and alpha for
translucency) is stored with 8 bits of precision (256 possible
values.) This configuration is very flexible and offers the best
quality. It should be used whenever possible.
So, how to write this method?
int createPixel(int r, int g, int b)
{
retrurn ?
}