[cairo] Patterns and clipping

Ian Britten britten at caris.com
Mon Jun 7 07:59:44 PDT 2010

Hi all,
[ cairo 1.8.6, 64-bit Linux ]
When drawing a pattern (eg: EXTEND_REPEAT to fill a polygon), is
is possible for any part of the pattern to extend past the
temporary surface it was created on?

Let me explain:
- I have a PDF (vector) surface.
- I create a similar temporary surface (eg: 10x10), and draw a
   diagonal line from one corner to another.
- Note the data points I use fall within the temporary surface.
- I draw the line with a thick lineweight, so that in theory, the
   lineweight extends past the edge of the surface, at the corners.
- I set that (with EXTEND_REPEAT) as the source on my PDF surface.

Now, because I'm working entirely with vectors, I had (naively)
hoped that the vectors would be 'replayed' when the pattern was
tiled within my polygon.  Specifically, I had hoped the line would
be redrawn with it's lineweight, and would thus bleeding out past
the edge of the temporary tile/surface I had created.

What actually seems to be happening is that my line is being
cropped at the edge of the surface/pattern, as if it was being
rasterized before being tiled onto the surface. (See attached).
Or, maybe the pattern sets a clip region before drawing itself?

Now, if I was working with an image surface, I would see this
happening, but I guess I had imagined the vector pattern would
just 'record' and 'replay' what had been rendered.

Could someone confirm that this is by-design, and isn't an
oversight?  I could imagine various cases where a pattern might
bleed out past the actual geometry rendered to it (such as via
cap styles, arcs/curves, lineweights, etc), and want to make sure
I proceed correctly.

Many thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pattern.png
Type: image/png
Size: 1054 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100607/5cec98d4/attachment.png>

More information about the cairo mailing list