生データから画像を読み込む方法が見つからないので、とても驚いています。それを行うためのエレガントな方法はありますか?生のビットマップバイナリデータ(ヘッダーなし)からQImageなどを作成する必要があります。
6973 次
2 に答える
3
ucharの配列を受け取るctorを使用して、生データからQImageオブジェクトを作成できます。QImageに提供されるデータの形式(RGB、RGBA、インデックス付きなど)を指定する必要があります
QImage ( uchar * data, int width, int height, Format format )
QImage ( const uchar * data, int width, int height, Format format )
QImage ( uchar * data, int width, int height, int bytesPerLine, Format format )
QImage ( const uchar * data, int width, int height, int bytesPerLine,
Format format )
http://doc.qt.digia.com/qt/qimage.html
例えば:
uchar* data = getDataFromSomewhere();
QImage img(data, width, height, QImage::Format_ARGB32);
お役に立てば幸いです。
于 2013-01-02T13:17:23.337 に答える
-1
あなたの質問は明確ではありません。Qpixmapを使用します。およびQbyte配列。それは超簡単。
QPixmap pic;
pic.loadFromData(array); //array contains a bite array of the image.
label->setPixmap(pic); //do what ever you want from the image. here I set it to a lable.
于 2013-01-02T13:49:27.507 に答える