2012-06-29 59 views

回答

1

QImage有一个构造函数,需要一个uchar* data。我想缓冲区存储在QByteArray中,所以尝试使用相应的构造函数来使用字节数组中的数据来构造一个QImage。如果你的QImage有效,从现在起很容易:

QImage swapped = originalImageFromBuffer.rgbSwapped(); 

PixelBufferData pbd(RGBX /* or RGBA_PRE, depends on the buffer format*/, swapped.width(), swapped.height(), swapped.width(), (void*)swapped.constBits()); 

myImageFrame->setImage(pbd);