painting suggestions

Riccardo Iaconelli riccardo at kde.org
Sat Sep 20 22:04:56 CEST 2008


hello,
so, I have the following code:

        QPixmap temp = *d->p;
        QPainter p(&temp);
        p.setCompositionMode(QPainter::CompositionMode_Source);
        p.drawPixmap(0, 0, *d->p);
        p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
        p.fillRect(temp.rect(), QColor(0, 0, 0, qreal(d->frame)*5.0/100.0));
        p.end();
        painter->drawPixmap(d->optV4.rect, temp);

where d->p is a cached pixmap of an expensive operation obtained through 
manipuladig a QImage, and shouldn't be changed for this reason.
I was wondering if that's the best approach (which requires a pixmap copy) or 
it's faster to call painter->setOpacity and then drawPixmap.

As my knowledge of the inner Qt painting system is not so wide, I'm asking 
here. =)

if you have questions, or need more code, please ask.

Bye,
-Riccardo
p.s. aye, that's raptor code, if someone wants more context (not sure if it's 
needed)
-- 
GPG key:
3D0F6376
When encrypting, please encrypt also for this subkey:
9EBD7FE1
-----
Pace Peace Paix Paz Frieden Pax Pokój Friður Fred Béke 和平
Hasiti Lapé Hetep Malu Mир Wolakota Santiphap Irini Peoch שלום
Shanti Vrede Baris Rój Mír Taika Rongo Sulh Mir Py'guapy 평화



More information about the Plasma-devel mailing list