[cairo] Polygon fill styles?

Jonathon Jongsma jonathon at quotidian.org
Fri Aug 22 06:54:34 PDT 2008

Ian Britten wrote:
> I'm trying to adapt my (Now-working! :) ) pattern stuff to use a
> mask instead, and have a couple of questions, mostly about the
> colour/alpha usage, I suspect.
> [ See my example from the other day, if you want full code ]
> Basically, I'm:
> - Making my temporary surface/context (Using CONTENT_COLOR_ALPHA)
> - Drawing my linework to it (Using set_source_rgba(1.0,1.0,1.0,1.0))
>    -> I'm assuming this identifies the 'on' pixels, like '1's in a
>       1-bit mask.
> - Making my (surface) pattern, from my temporary surface (Using
> - Configuring the transformation on the pattern
> - Setting the mask (pattern) onto my destination context
> - Setting the colour on my destination context
>    (eg:  set_source_rgba(0.5, 0.5, 0.5, 0.5); )
>    -> I'm assuming this applies the desired colour, and since the
>       colour in the mask should basically be irrelevant (ie: 1-bit)
> - fill

mask() will actually paint the source to the masked region, so you 
should make sure to set the source *before* masking().  This also means 
that you shouldn't need the fill.


More information about the cairo mailing list