Paths
Explore the concept of paths in computer graphics using Python's Pycairo library. Learn to create complex shapes composed of lines, arcs, and Bezier curves. Understand how paths consist of one or more sub-paths that can be open or closed. Gain practical knowledge of constructing shapes with multiple sub-paths, including polygons, sectors, disjointed shapes, and holes. This lesson helps you build advanced vector graphics using path operations and prepares you for more sophisticated drawing tasks.
We'll cover the following...
Paths
A path is the most general type of shape. It is made up of one or more edges, which can consist of straight lines, arcs, or curves (specifically, Bezier curves). Here are a few complex paths:
The first three paths are created as follows:
- Path A is created from 6 straight lines.
- Path B consists of 2 straight lines and a circular arc.
- Path C consists of 2 straight lines and 2 Bezier curves.
Each of the paths in the image has its own characteristics, to illustrate the variety of different forms a path can take: