你能用的是
QImage ( uchar * yourdata, int w, int h, int depth, QRgb * colortable, int numColors, Endian bitOrder );
这个函数吧?
这个函数我试过,不行,因为colortable设置不好会倒置象素放大或缩小造成图像混乱;
我是这样解决的.
QRgb rgb;
QPainter *paint=new QPainter;
i=0;
if(bm.create(width,height,32,0,QImage::IgnoreEndian))
{ for (x = 0; x < height ; x++) {
for (y = 0; y <width; y++) {
r=(int)bit[i+2];
g=(int)bit[i+1];
b=(int)bit;
uint *pp = (uint *)bm.scanLine(x) + y;
*pp = qRgb(r,g,b);
i=i+3;
}
}
}
看得懂的就好,看不懂的我也没办法了.