PDA

View Full Version : Drawing speed: QPixmap vs QPicture



maverick_pol
2nd January 2008, 10:27
Hi,

I am planning to use QPixmaps or QPicture. I have to draw 1000 elements(which are simple shapes, or more complex ones build of simple ones). I also need to use some of them as "backgrounds" so decided to use QPixmap class. I could use QPixmap item for drawing point element as well as background(setBrush(QBrush(QPixmap file)). Still, I am not sure will this be the best solution. Maybe, it would be better to store elements as .pic files and draw them later using a painter in the background of my scene?

Is drawing a QPicture faster than QPixmap?


Thanks for any idea.

Maverick

jacek
2nd January 2008, 19:17
Is drawing a QPicture faster than QPixmap?
QPicture is just a set of commands. If you want to draw it somewhere, Qt will have to execute all of those commands. While QPixmap is a bitmap stored in memory, so drawing it is just a matter of copying a memory region (provided that there are no transformations).

QPicture is good way for preparing vector graphics. Epecially if you want to save it later as SVG or PostScript.