[cairo] Resend: Stroke a 'frame' around a complex shape based on several paths. Possible?

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Mon Mar 30 12:21:36 PDT 2009

Hi Stefan,

On Mon, 30 Mar 2009, Stefan Landvogt wrote:

> My aplologies: I seem to have problems to actually sent to the mailing
> list...

Your mails arrive okay.  If you're not receiving them, then perhaps 
have own-mail-forwarding turned off in mailman?

> lets assume, that I have two overlapping rectangles. A big one (0, 0, 100,
> 100 defined as bigBoxPath) and a small one ( 40, 60, 60, 120 defined as
> smallBoxPath) that has some part of it outside the bigger rectangle. The
> outer rect for that whould be something like (0, 0, 100, 120, defined as
> outerBoxPath) without taking in account, that a stroke would make that
> bounding rect bigger because of how the stroke works.
> I can create a path and fill them both, but now I want to stroke around the
> outline of the complete shape, but no 'stroke' should appear inside the
> shape. Also it would be nice, if this stroke can happen with a dashed
> line...

If I'm reading this right you could first just stroke all individual 
paths however you like to the target surface and then fill all the 
individual paths.  As long as the fill pattern is opaque, then the 
latter fills will cover up any strokes you don't want to see.

If your fill pattern is not opaque then you can create temporary A8 
mask surfaces containing only a) the stroke, b) the fill, and then 
remove the fill-mask surface from the stroke-mask surface using 
OPERATOR_OUT/DEST_OUT.  Then once you have the individual mask 
surfaces you can use cairo_mask() to paint them onto the target with 
whatever source pattern you want even if it has non-opaque bits.


More information about the cairo mailing list