[cairo] global clip for a cairo context
Adrian Johnson
ajohnson at redneon.com
Sat Jan 2 21:47:04 PST 2016
On 03/01/16 00:41, Enrico Weigelt, metux IT consult wrote:
> Hi folks,
>
> is it possible to set a global clip onto an cairo context, which
> remains for the lifetime of the context (or until explicitly reset),
> so it will never ever paint outside these boundaries ?
>
> I'm looking for a way to achieve clipping in my tiny widget toolkit.
> The individual widget's paint callback should get passed a cairo_t*,
> representing it's paint area, just like if it had its own surface.
Assuming a rectangular clip you could use something like:
clipped_surf = cairo_surface_create_for_rectangle (cairo_get_target
(cr), x, y, w, h);
clipped_cr = cairo_create (clipped_surf);
>
> --mtx
>
> --
> Enrico Weigelt,
> metux IT consulting
> +49-151-27565287
>
More information about the cairo
mailing list