What is PixelFormat.RGBX_888

半城伤御伤魂 提交于 2019-12-07 05:47:45

问题


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.


回答1:


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;
}


来源:https://stackoverflow.com/questions/32348053/what-is-pixelformat-rgbx-888

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!