[cairo] Question about cairo_fill_preserve

Meryl Silverburgh silverburgh.meryl at gmail.com
Fri Jan 4 12:43:35 PST 2008


Thanks to both of you.

On Jan 4, 2008 2:36 PM, Dirk Schönberger <dirk.schoenberger at sz-online.de> wrote:
> > If I use cairo_line_to(), and cairo_move_to() to draw something like this:
> > |       |
> > ---------
> > |       |
> > ---------
>
> > I see it when i use 'cairo_stroke_preserve()'
>
> > But what if I want to fill the bottom rectangle , i try using
> > cairo_fill_preserve(), but nothing appear.
>
> From your code I see that you use to many calls to cairo_moveto
> The item you want to have filled should be created with one call to
> cairo_moveto, the rest should only be cairo_lineto.
> The first cairo_moveto of your path definition also defines the endpoint,
> i.e. the point wich is used to close the element in order to fill.
>
> For the given points
>
> A            D
>    |       |
> B --------- E
>    |       |
> C --------- F
>
> I _think_ the correct sequence should be
>
> moveto (A)
> lineto (B)
> lineto (C)
> lineto (F)
> lineto (E)
> lineto (D)
>
> // needed to only fill the BECF rectangle
> lineto (E)
> lineto (B)
>
> closepath
>
>
> Regards
> Dirk
>
>
>
>
>


More information about the cairo mailing list