标题:qvfb显示图像问题
作者:ljw_725
日期:2006-03-27 10:01
内容:
我编写的一个显示16bpp (rgb565)的视频数据
实验程序如下,用0xcccc来构建(setPixel)一个QImage,然后用QPainter显示在一个Widget上
现在只有用QT-X11编可以正常显示,用qt-embeded-forx86编译,用qvfb显示,不管用16bpp还是32bpp的qvfb都显示不出来,就是执行完p.drawImage(0,0,*img);但是什么也没显示,而且更怪的是普通的BMP图像在X11下也可以显示,但在QVFB中就显示不出来,这时为什么?
#include "VideoWidget.h"
#include "YUV2RGBConverter.h"
#include "common.h"
#include
#include
#include
#include
#include
#include
#include
VideoWidget::VideoWidget(QWidget* parent):QWidget(parent)
{}
void VideoWidget::playVideo ()
{
int i,j;
qDebug("before painter\n");
QPainter p (this);
qDebug("after conver\n");
qDebug("before new\n");
//QImage *img=new QImage ("/root/Code/testyuv/1.bmp");
//QImage *img=new QImage(400,400,16,0,QImage::IgnoreEndian);
//QImage *img=new QImage(400,400,16,0,QImage::BigEndian);
QImage *img=new QImage(176,144,16,0,QImage::LittleEndian);
/*
int filesize=img->bytesPerLine();
int hei=img->height();
int wid=img->width();
int depth= img->depth();
int order = img->bitOrder();
qDebug("filesize = %d",filesize);
qDebug("hei = %d",hei);
qDebug("wid = %d",wid);
qDebug("depth = %d",depth);
qDebug("order = %d",order);
*/
//img->load("/root/Code/testyuv/1.bmp");
unsigned short rgb = 0xcccc;
unsigned short *out = &rgb;
qDebug("after rgb\n");
for(i=0; iloadFromData(dest_ori,558200);
// if(!flag) qWarning(&q ..
#1 [skly22222 03-27 20:51]
显示代码应该是这样,你试试看行不行:
p.begin(this);
p.drawImage(0,0,*img);
p.end();