PDA

View Full Version : What's faster: QPixmap-to-QImage or QImage-to-QPixmap



forrestfsu
13th December 2006, 19:43
Before writing any trials I wanted to see if anyone knew which was faster.

wysota
13th December 2006, 20:15
On Unix they are (or at least were in Qt3) both hell slow, so try to avoid both, especially for large images. On Windows this is a practically costless operation. I didn't make any tests but I think they are the same in cost as they do the same operations just the other way round.

Glitch
15th December 2006, 17:11
You want to convert between these types as little as possible becuase there is the possibility of slowness eveywhere. Its particularly bad on X11. Here is the deal.

QPixmap is graphics memory. On X11 it resides on your XServer. On all platforms there is a the chance that the memeory could be loaded physically on your graphics card. This make QPixmap very fast to render with drawPixmap and dra eto with drawLine,Rect,Ploygon etc. This also amkes QPixmap very so to load from the disk and makes it impossible to polll for pixel colors or change individual pixel colors. If you want to keep a doublebuffer or images for display QPixmap is what you want.


QImage resides in your process space. It MUST be converted to a QPixmap to render to the screen. All drawing commands will be done in Qt4 using a software renderer which is very slow. QImage is ideal for loading files formthe disk and performing pixel manipularions. So if you want to make a historgram QImage is what you want.

Good Luck,
--Justin