2. Cairo definitions

Context

The Cairo context holds all of the graphics state parameters that describe how drawing is to be done.

cairo_t *cr;
cr = gdk_cairo_create(widget->widow);

These two lines create a cairo context.

Path

There are two kinds of paths:

1. Open (starting and ending points do not meet)
2. Closed (starting and endding points meet)

Source

There are four kinds of basic sources:

1. colors
2. gradients
3. patterns
4. images

Surface

The documentation mentions the following surfaces:

typedef enum _cairo_surface_type {
  CAIRO_SURFACE_TYPE_IMAGE,
  CAIRO_SURFACE_TYPE_PDF,
  CAIRO_SURFACE_TYPE_PS,
  CAIRO_SURFACE_TYPE_XLIB,
  CAIRO_SURFACE_TYPE_XCB,
  CAIRO_SURFACE_TYPE_GLITZ,
  CAIRO_SURFACE_TYPE_QUARTZ,
  CAIRO_SURFACE_TYPE_WIN32,
  CAIRO_SURFACE_TYPE_BEOS,
  CAIRO_SURFACE_TYPE_DIRECTFB,
  CAIRO_SURFACE_TYPE_SVG,
  CAIRO_SURFACE_TYPE_OS2
} cairo_surface_type_t;

Mask

Before the source is applied to the surface, it is filtered first. The mask is used as a filter. The mask determines, where the source is applied and where not. Opaque parts of the mask allow to copy the source. Transparent parts do not let to copy the source to the surface.

Pattern

A cairo pattern represents a source when drawing onto a surface. In cairo, a pattern is something that you can read from, that is used as the source or mask of a drawing operation. Patterns in cairo can be solid, surface-based, or even gradients patterns.

Table Of Contents

Previous topic

1. Introduction

Next topic

3. Cairo backends