[Qt-interest] Inverting a QPainterPath

Josiah Bryan jbryan at productiveconcepts.com
Wed Oct 7 17:25:36 CEST 2009


Jason H wrote:
> You may have to fall back to pixels, blitting transparency as needed.

Hmmm...so something like paint an alpha mask with the QPainterPath on a 
pixmap, invert the pixmap's alpha channel.....umm, Im lost here.  How 
would I get from QPainterPath -> pixels -> back to clipping info for a 
QPainter again?


> 
> 
> 
> 
> ----- Original Message ----
> From: Josiah Bryan <jbryan at productiveconcepts.com>
> To: Qt Interest <qt-interest at trolltech.com>
> Sent: Wed, October 7, 2009 10:56:22 AM
> Subject: [Qt-interest] Inverting a QPainterPath
> 
> Is there a way to "invert" a QPainterPath?
> 
> Here's what I want to do:
> 
> -Create QPainterPath
> -Add Text to it (say, "Foobar")
> -"Invert" the path so I can use it as a clipping path for a QPainter
> -Fill QPainter with some Image
> -Now only the pixels of the image OUTSIDE the letters "Foobar" are 
> painted. (e.g. the background already existing "shows thru" the letters 
> "foobar".)
> 
> In reading the QPainterPath documentation at 
> (http://doc.trolltech.com/4.5/qpainterpath.html), I dont see a way to 
> "turn inside out" or "invert" the QPainter path. For example, in GIMP, 
> you can create a selection (or path from text) then "invert" it so 
> everything but the original path is selected. Is that dooable with a 
> QPainterPath?
> 
> Thanks for your time!
> 
> -josiah
> 

-- 

-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com
(765) 964-6009, ext. 224




More information about the Qt-interest-old mailing list