Plasma::Svg question

Aaron J. Seigo aseigo at kde.org
Mon Oct 6 21:46:35 CEST 2008


On Monday 06 October 2008, Toussis Manolis wrote:
> I need a little help about Plasma::Svg
>
> I know I can use paint() to draw a Plasma::Svg object on the QPainter of a
> Plasma applet.
> What I need is to draw it with alpha=0.3 . How I can do that?

this isn't specific to Plasma::Svg, but applicable to any pixmap painting of 
this type.

what you can do is paint the Svg to a temporary pixmap, and then paint over it 
using a colour the appropriate alpha value. see QPainter::setCompositioMode 
for how to set how paint operations like this get combined.

then you paint that temporary pixmap onto your applet.

you can also call setOpacity on the QPainter directly, but that can *very* 
slow and that above method is usually faster, and at worst the same speed.

if you can describe your use case in more detail, we may be able to offer more 
specific directions (e.g. perhaps PaintUtils::transition would work for you, 
but that highly depends on what you are trying to do).

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081006/8c4717a2/attachment.sig 


More information about the Plasma-devel mailing list