[Interest] Force QPainter color draw for SVG files?

alessandro.portale at nokia.com alessandro.portale at nokia.com
Tue Apr 17 15:32:20 CEST 2012


Another variant: You could also render the original (black) SVG element to a temporary QImage, then use pixel manipulation to colorize it to red, and then render that image to the main painter.

________________________________
From: interest-bounces+alessandro.portale=nokia.com at qt-project.org [interest-bounces+alessandro.portale=nokia.com at qt-project.org] on behalf of ext Jason H [scorp1us at yahoo.com]
Sent: Tuesday, April 17, 2012 15:19
To: wargand at gmx.de; jaume dominguez faus
Cc: Qt Interest
Subject: Re: [Interest] Force QPainter color draw for SVG files?

Really, what you should do it what he describes, but render it to a PNG/Pixmap, and store that.

________________________________
From: "wargand at gmx.de" <wargand at gmx.de>
To: jaume dominguez faus <jaume at land.aau.dk>
Cc: Qt Interest <interest at qt-project.org>
Sent: Sunday, April 15, 2012 6:57 PM
Subject: Re: [Interest] Force QPainter color draw for SVG files?


SVG is xml. Just load it into a QDomDocument and change the colour.
If the SVG does not change too much, you could even do a search and
replace of the color values. There are many ways to achieve what you
want, forcing the QPainter to use a certain colour when rendering a SVG
image... I am not so sure about that.

Btw... SVG isn't the most resource friendly format.

Guido


On Sun, Apr 15, 2012 at 02:45:37PM +0200, jaume dominguez faus wrote:

> Hi list.
>
> I guess the answer is "No". But maybe.... is it possible to force
> QPainter to paint only in, say "red", when I'm rendering a SVG
> that is black?  Imagine that you have a set of symbols in SVG
> files similar to a font characters, and you want to paint them in
> different colors when they are selected. Is it possible to do it
> without making the "selected version" of each SVG file?
>
> Thanks.
> ____________________________________________________________________
> Interest mailing list Interest at qt-project.org<mailto:Interest at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120417/af2ec632/attachment.html>


More information about the Interest mailing list