[cairo] Clip documentation and behaviour

Maximilian Heinzler m.heinzler at heinzler.de
Sun Jun 11 12:04:42 UTC 2017

Hi all,

while going through the clip functions I noticed two things:

1. The documentation for cairo_clip() says: "Calling cairo_clip() can
only make the clip region smaller, never larger".

Isn't that wrong? If I call cairo_clip() twice with different paths
the clip region obviously grows.

Then also the first sentence "Establishes a new clip region by
intersecting the current clip region with the current path" seems to
be wrong, because intersecting the two would mean that the clip region
can only get smaller.

2. Calling cairo_in_clip() on an image surface with no clip will
always return true, even if the point is outside the surface. I'm OK
with that, if you define no clip as an infinitely large clip region.

But on the other hand calling cairo_clip_extents() on the same surface
will return the extents of the surface, which would mean that no clip
here is defined as a clip region of the same size as the surface.

Is this the expected behavior of the two functions? I think it would
be more consistent if cairo_in_clip() would also take the size of the
surface into account and return false for points outside the surface.


More information about the cairo mailing list