2

したがって、次のように入力します。

QBuffer* buffer = new QBuffer(this->Conex);
QImage* image = new QImage ();
image->loadFromData (buffer->buffer());

これは私にはうまくいきません。

4

1 に答える 1

5

バッファーに生のピクセル データが含まれている場合、次のコンストラクターを使用して幅、高さ、および bpp を指定することができます。

QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format )

編集:

それがこのコンストラクターの使用方法です。

int imageWidth = 800;
int imageHeight = 600;
int bytesPerPixel = 4; // 4 for RGBA, 3 for RGB
int format = QImage::Format_ARGB32; // this is the pixel format - check Qimage::Format enum type for more options
QImage image(yourData, imageWidth, imageHeight, imageWidth * bytesPerPixel, format);
于 2011-09-25T14:31:56.117 に答える