[cairo] Is Cairo able to fit my needs?

Dirk Schönberger dirk.schoenberger at sz-online.de
Thu Oct 4 10:55:05 PDT 2007


> I tried your suggestion with CAIRO_FILL_RULE_EVEN_ODD and
> CAIRO_FILL_RULE_WINDING. Two black squares overlapping each other, each in
a
> single path:

The fill rule works when the path is rendered, not on the surfaces.
You should try to paint both sub-paths in one action, i.e.

cairo_new_sub_path( cr);
cairo_line_to( cr, 0, 0 );
cairo_line_to( cr, 0, 1000 );
cairo_line_to( cr, 1000, 1000 );
cairo_line_to( cr, 1000, 0 );
cairo_line_to( cr, 0, 0 );
cairo_close_path( cr );

cairo_new_sub_path( cr);
cairo_line_to( cr, 200, 200 );
cairo_line_to( cr, 200, 400 );
cairo_line_to( cr, 400, 400 );
cairo_line_to( cr, 400, 200 );
cairo_line_to( cr, 200, 200 );
cairo_close_path( cr );

cairo_set_source_rgba( cr, 0, 0, 0, 1);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);

Regards
DIrk




More information about the cairo mailing list