[cairo] Re: How to use clipping?
lemieuxs at iro.umontreal.ca
Tue Aug 3 10:47:54 PDT 2004
Thanks for the fast reply! I guess I'm still missing something, here is
a sample of code I wrote (the none cairo_ calls are just wrappers in the
object class and all work is done on the cairo_t *mImage):
move_to (mView_min_x + 10, mView_min_y + 10);
line_to (mView_min_x + 10, mView_max_y - 10);
line_to (mView_max_x - 10, mView_max_y - 10);
line_to (mView_max_x - 10, mView_min_y + 10);
line_to (mView_min_x + 10, mView_min_y + 10);
move_to (mView_min_x, mView_min_y);
line_to (mView_max_x, mView_max_y);
set_rgb_color (0, 0, 0);
I've included the resulting image as a png where we can see that the
diagonal line is drawn both within and beyond the clipping region. The
last stroke() draws both the clipping rectangle and the diagonal line.
On Tue, 3 Aug 2004, Carl Worth wrote:
> Within the cairo graphics state, there is a notion of a current clipping
> path. Initially, this path is infinitely large, (eg. no clipping is
> Calling cairo_clip computes a new clipping path by intersecting the
> current clipping path with the current path, (ie. the path formed with
> things like cairo_move_to/line_to/curve_to). After that, the effect of
> all subsequent drawing operations will be restricted to the area within
> the current clipping path.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4683 bytes
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040803/3aa6aeaa/test.png
More information about the cairo