[cairo] Polygon fill styles?

Carl Worth cworth at cworth.org
Mon Sep 8 14:23:44 PDT 2008


On Mon, 2008-08-25 at 13:50 -0300, Ian Britten wrote:
> mask data correctly (At all!).  One called 'evince' seems to show
> it correctly though.
> 
> Can anyone recommend a good PDF viewer that I can have confidence
> in?  (Ideally, a viewer on Linux and one for Windows - They don't
> have to be the same...)  I hate wasting peoples time just because
> of a viewer...

Evince is definitely what I recommend, (though I only have experience
on Linux---none on Windows), for a free-software PDF viewer. If you're
interested in a non-free viewer, Adobe distributes its acroread
software, and its implementation is the de facto standard for PDF-viewer
correctness.

> Now that I see the mask result, it appears that it does not actually
> use the path I had previously set into my PDF context (ie: The
> polygon I wanted filled), and has actually filled the entire
> surface with the mask.  I'm gathering that this is the expected
> behaviour (Just not what I'm looking for).

Yes, that's what cairo_mask does. If you want its result to be clipped
to a path, then you would do this:

    ... set your path here ...
    cairo_clip (cr);
    cairo_mask (cr);

And you might want to put a cairo_save(cr); before that and a
cairo_restore(cr); afterwards so that the clipping effect is temporary.

> In the end, after all this "pattern vs mask" experimentation, I
> think I understand what's going on a lot better.  Many thanks to
> everyone for their patient help!

Excellent. I'm glad you found useful help here. Please come back often
as needed. :-)

Have fun with cairo,

-Carl




More information about the cairo mailing list