PDA

View Full Version : Fast image drawing/scaling in Qt 3.3



eriwik
21st June 2006, 11:06
I'm working on an application which plays one or more sets of images as an animation. Currently I load the image to be drawn into a QPixmap and use bitBlt() to copy the image onto a QWidget used as a canvas. When playing two sets I bitBlt() the second image onto the same canvas but to the left of the first image.

Now I'm etending the functionality of the application to handle a dynamic number of image-sets, be able to scale individual images and scale the results. The customer will be given more freedom of where each set will be placed in relation to other sets and how large each set will be (in pixels). This means that I'll have to be able to scale individual images. In addition the customer will be able to specify a max-size of the final image, which means that I'll have to be able to scale the final image (the result of bitBlt()-ing the images onto a new image/canvas.

Since I can not scale an image using the QPixmap I would have to use a QImage, however a QImage can not bitBlt() to a QPaintDevice/QWidget (my canvas) and in the documentation it says that conversion between QImage and QPixmap is slow. I'm wondering how slow and if anyone has any advice of a perhaps better solution (I've been thinking about using QGL but have not investigated it yet)?

munna
21st June 2006, 11:45
There is an example called showimg in Qt 3 examples. I think you need something similar to that. If you resize the window in that example the image resizes itself to fit the window. Even in that example there is some kind of conversion happening and its pretty ok.