[Cairo] Rectangle-based clipping for surfaces
keithp at keithp.com
Wed Oct 15 13:04:21 PDT 2003
Around 11 o'clock on Oct 15, Bill Spitzak wrote:
> My personal feeling is that the only way to increase the clip region should
> be a cairo_restore call. Can you instead use a single call that takes a list
> of rectangles? Then that call can union the rectangles and then intersect
> with the current clip.
I think it's important to keep the intended usage for this operation in
mind. The requirement is that we provide device pixel clipping for things
like Expose events. In the Expose event case, we need to incrementally
construct the clip list from a sequence of expose events, once the set is
complete, we want to render everything restricted to that clip list. The
proposed API (clip_begin/clip_rectangle) precisely matches this usage.
We could also have an 'clip_end' call and say that the accumulated
rectangles are intersected with the current pixel clip at that point;
that's actually necessary for X operations in any case.
Alternatively, we could expose a new data type (cairo_region) along with
calls to construct it from rectangles. I'd like to avoid that as it seems
More information about the cairo