[cairo] How can I fin out out the current clip region of cairo
M Joonas Pihlaja
jpihlaja at cc.helsinki.fi
Thu Feb 25 14:08:10 PST 2010
On Thu, 25 Feb 2010, silverburgh wrote:
> >From cairo documentation
> http://www.cairographics.org/manual/cairo-context.html#cairo-clip, it
> The current clip region affects all drawing operations by effectively
> masking out any changes to the surface that are outside the current
> clip region.
> Can you please tell me how can I print out the current cairo clip
> region to screen/file for debugging purpose?
You can get the clip region as a list of rectangles using
cairo_copy_clip_rectangle_list(). If the clip isn't possible to
represent as rectangles that won't do you any good though.
An alternative way to debug the clip might be to paint with solid
white to a temporary surface something like this and seeing where the
cairo_set_source_rgb (cr, 1, 1, 1);
clip_pattern = cairo_pop_target (cr);
cairo_pattern_get_surface (clip_pattern, &clip_surface);
cairo_surface_write_to_png (clip_surface, "clip.png");
Hope that helps,
More information about the cairo