Learning Objectives
We will learn about the following topics in detail in the upcoming lessons
We'll cover the following
Upcoming topics
Pycairo draws its output to a surface. There are separate surface types for different types of output, each derived from the abstract base type Surface
. Normally, we create a surface of the required type, and then we obtain a Context
to do the drawing.
There are separate surfaces for various output formats, namely:
- ImageSurface: for creating pixel image output, and it is useful for PNG output and for transferring image data to NumPy or Pillow.
- SVGSurface:for creating SVG output.
- PDFSurface:for creating PDF output.
- PSSurface:for creating PostScript (PS) or Encapsulated PostScipt (EPS) output.
There are several surfaces that are not used to create output, namely:
- RecordingSurface: records high-level drawing operations that can be “played back” to another surface, for example, to add a starting template to another surface.
- ScriptSurface: records drawing operations as a script.
- TeeSurface: allows two or more surfaces to be drawn simultaneously.
Pycairo can also be used with GTK windows. GTK uses Cairo internally, so the GTK drawing callback supplies a Pycairo Context to be drawn on.
Each of these surfaces is described in the upcoming lessons. We will look at the main features of each surface, although some of the more specialized ones will be covered in lesser detail and we will need to look at the documentation for the Cairo library itself for these.
Get hands-on with 1400+ tech skills courses.