[cairo] Polygon fill styles?

Ian Britten britten at caris.com
Fri Aug 22 07:30:23 PDT 2008


Jonathon Jongsma wrote:
> 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
>>    EXTEND_REPEAT)
>> - 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.

Really?
Note that http://www.tortall.net/mu/wiki/CairoTutorial confusingly
describes 'mask' as both a Noun and Verb.  I guess I thought I was
setting the mask (Noun case), not doing a mask operation (Verb).
[ Reading the actual cairo docs though does state that mask is a
"drawing operator" ...  mea culpa ...  :( ]

Hmmm...  That's going to make it difficult to integrate, since in
some cases I have to:
- set up the path
- configure the fill attributes (including *mask*, colour, etc)
- fill_preserve()
- configure the boundary attributes (colour, thickness, etc)
- stroke()


Irregardless, your suggested changes don't seem to work for me.
In fact, now I seem to get no output - Just a white page (Although
the PDF file is non-empty).
[ FWIW, I'm using cairo v1.6.4 and cariomm v1.6.0, in case this
stuff has maybe changed recently ]

Ian


More information about the cairo mailing list