Re: global clip for a cairo context
Adrian Johnson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
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 > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo