2012-06-29 70 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);