Search⌘ K
AI Features

More on Clipping

Explore how to apply and intersect multiple clipping paths in Pycairo. Understand how to reset clip regions using save, restore, and reset_clip functions. Learn about useful clipping functions like clip_preserve, clip_extents, and how to use paint within clip-path boundaries to control drawing areas precisely.

Calling clip multiple times

You can call the clip function more than once. This creates a new clip-path by intersecting a new path with the existing clip-path.

Here is an example of this:

First, we create a path consisting of a circle with a radius of 125 and its center at (150, 150). Then we call the clip function to set it as the clip-path (clip region 1 in the diagram).

Then, we create another path consisting of a circle with a radius of 125 and its center at (250, 200), and call the clip function again (clip region 2 in the diagram).

The final clip region results from the intersection of clip region 1 and clip region 2, as is shown in the final panel of the diagram.

One ...