我想将X8B8G8R8格式的硬件像素缓冲区转换为无符号整型24位内存缓冲区。将X8B8G8R8转换为R8G8B8 C++代码
这里是我的尝试:
// pixels is uin32_t;
src.pixels = new pixel_t[src.width*src.height];
readbuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
const Ogre::PixelBox &pb = readbuffer->getCurrentLock();
/// Update the contents of pb here
/// Image data starts at pb.data and has format pb.format
uint32 *data = static_cast<uint32*>(pb.data);
size_t height = pb.getHeight();
size_t width = pb.getWidth();
size_t pitch = pb.rowPitch; // Skip between rows of image
for (size_t y = 0; y<height; ++y)
{
for (size_t x = 0; x<width; ++x)
{
src.pixels[pitch*y + x] = data[pitch*y + x];
}
}
所以,您有什么问题的阿尔法转换? – auburg
而结果/问题是? – Matt