painting suggestions

Robert Knight robertknight at gmail.com
Mon Sep 22 02:04:04 CEST 2008


Hi Riccardo,

Fredrik has answered this one on techbase:

http://techbase.kde.org/Development/Tutorials/Graphics/Performance#QPainter::setOpacity.28.29

Regards,
Robert.

2008/9/20 Riccardo Iaconelli <riccardo at kde.org>:
> 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 평화
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>


More information about the Plasma-devel mailing list