Clipping

In this lesson, we'll learn how to use the `clip` function in Pycairo.

What is clipping?

Under normal circumstances, Pycairo allows us to draw anywhere on the page.

When we define a clip region, we can only draw within that defined region. Anything outside that region will not be drawn.

The diagram below shows this. The clip region is a square, shown in grey in the first panel of the slide. The path consists of a green square and a thick orange line, shown in the center panel. The clip-path is indicated by the dashed line:

Get hands-on with 1400+ tech skills courses.