# [cairo] Questions about operators, clipping and etc

Andrea Canciani ranma42 at gmail.com
Sun Jun 19 07:32:18 PDT 2011

```On Sun, Jun 19, 2011 at 2:30 PM, Taekyun Kim <podain77 at gmail.com> wrote:
> Hi all,
> I have several questions about cairo internals.
> 1. Clipping and masking equation
> According to http://cairographics.org/operators, there're three kinds of
> clipping equations,
> XRender, Bounded and Simple. However I couldn't find any case where XRender
> and
> Bounded equations produce different results. What's the difference between
> them?

Basically when you use a Bounded operator, you are not touching anything
outside the extents of your mask, while an XRender operator can change the
For example if you do an "IN" operation, everything outside the mask but
inside the clip becomes transparent.

> 2. Unbounded operation
> Unbounded interpretation is introduced as follows:
>   The area where the compositing operation is performed is not bounded by
> the
>   mask. Instead, any parts where the source layer is not transferred are
> considered
>   to be fully transparent. We call this interpretation of the
> source unbounded.
> So does this mean that following equations??
> dst = 0 (mask is not allowed)

The equation which follows from the description is:
dst' = ((src IN mask) OP dst) LERP_clip dst

In particular, it explains the (src IN mask) part, i.e.
the source is cleared outside the mask.

> 3. Limit boxes
> Boxes, traps, polygon can have there limit boxes. I thought the boxes should
> be disjoint,
> because I couldn't find any handling of overlapping boxes. Is this true?

No, overlappping boxes are handled by the tessellator and/or the rasterizer.

> 4. cairo_composite_rectangle_t
> In case of cairo_fill(), the member "bounded" is calculated by fill extents
> approximation.
> So although a path is finally tessellated into a single box, it might not be
> the same with
> "bounded", right?

Right

Andrea

>