What is PixelFormat.RGBX_888
Asked Answered
O

1

10

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.

Outspeak answered 2/9, 2015 at 8:21 Comment(0)
M
14

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;
}
Mona answered 2/9, 2015 at 8:39 Comment(1)
Lately it's mentioned here: developer.android.com/reference/android/hardware/…Dasteel

© 2022 - 2024 — McMap. All rights reserved.