Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is PixelFormat.RGBX_888

As the title said, anyone know what is RGBX_8888 pixel format? and what is the difference with RGBA_8888? Is RGBA_8888 offers an alpha channel but RGBX_8888 does not?

The android documentation does not give much information on this unfortunately.

Thanks.

like image 840
CodingBird Avatar asked Sep 02 '15 08:09

CodingBird


1 Answers

RGBX means, that the pixel format still has an alpha channel, but it is ignored, and is always set to 255.

Some reference:

Blackberry PixelFormat (It is not android, however I guess that the naming conventions stay same across platforms.)

The RGBX 32 bit RGB format is stored in memory as 8 red bits, 8 green bits, 8 blue bits, and 8 ignored bits.

Android 4.1.2 source code (texture.cpp) Line 80

There is a function called PointSample, where it samples based on a template format, and the passed parameters. You can see, that at pixelformat RGBX_8888, the alpha channel is ignored and set to 255, while at RGBA_8888, it is normally sampled.

if (GGL_PIXEL_FORMAT_RGBA_8888 == format)
    *sample = *(data + index);
else if (GGL_PIXEL_FORMAT_RGBX_8888 == format)
{
    *sample = *(data + index);
    *sample |= 0xff000000;
}
like image 154
Sipka Avatar answered Nov 14 '22 19:11

Sipka