[cairo] clip path not getting restored by cairo_restore
Tim Rowley
tor at cs.brown.edu
Thu Nov 25 06:19:43 PST 2004
I'm seeing a problem where the clip path is not getting restored
by cairo_restore(). In the following snippet suitable for the
cairo_snippets environment, only the red rectangle inside the
clip path is shown. The green rectangle outside the save/restore
will not appear unless the cairo_clip() call is commented out.
cairo_save(cr);
// upper right quadrent clip
cairo_new_path(cr);
cairo_move_to(cr, 0.5, 0.5);
cairo_line_to(cr, 1.0, 0.5);
cairo_line_to(cr, 1.0, 0.0);
cairo_line_to(cr, 0.5, 0.0);
cairo_close_path(cr);
cairo_clip(cr);
// upper right quadrent rectangle (red)
cairo_new_path(cr);
cairo_move_to(cr, 0.5, 0.5);
cairo_line_to(cr, 1.0, 0.5);
cairo_line_to(cr, 1.0, 0.0);
cairo_line_to(cr, 0.5, 0.0);
cairo_close_path(cr);
cairo_set_rgb_color (cr, 1, 0, 0);
cairo_fill(cr);
cairo_restore(cr);
// lower left quadrent rectangle (green)
cairo_new_path(cr);
cairo_move_to(cr, 0.0, 1.0);
cairo_line_to(cr, 0.5, 1.0);
cairo_line_to(cr, 0.5, 0.5);
cairo_line_to(cr, 0.0, 0.5);
cairo_close_path(cr);
cairo_set_rgb_color (cr, 0, 1, 0);
cairo_fill(cr);
More information about the cairo
mailing list