PDA

View Full Version : how to use bitBlt in QT 3



garry_3peace
11th September 2008, 02:32
I have try to use bitBlt but it seems failed. the "buffer" is null. Is there any problem with the code?


QImage hehe("f_rain1m_e5bff66.jpg" );
QImage buffer;
bitBlt(&buffer, 4, 5 , &hehe, lstBox->x(), lstBox->y(), lstBox->width(), lstBox->height(), CopyROP);
lstBox->setPaletteBackgroundPixmap(buffer);
qWarning("%d",buffer.isNull());

NB:
The result in terminal is 1 which mean the buffer is still null, right?

punit.doshi.85
11th September 2008, 07:55
hi, did u got the code working ??
can u please send me d code pls, i too need it for seeing the blitting thing n it mite save much of my time. i am using Qt 4.4

thanks in advance,
Punit.

jacek
11th September 2008, 19:58
QImage buffer;
You create a null image. Give it some size.

garry_3peace
12th September 2008, 03:37
Hm... I see, Ok.. I'll try it later...

garry_3peace
15th September 2008, 15:09
Hm... still failed..

I declared it like this:

QImage buffer(200,200, 1); //right?

jacek
15th September 2008, 21:20
QImage buffer(200,200, 1); //right?
Why "1"? Shouldn't it be 32?


bitBlt(&buffer, 4, 5 , &hehe, lstBox->x(), lstBox->y(), lstBox->width(), lstBox->height(), CopyROP);
CopyROP is from the Qt::RasterOp enum, not Qt::ImageConversionFlags. Pass 0 as the last argument, if you don't know what to put there.

What are the values of x(), y(), width() and height()?