User Tools

Site Tools


k25:k25.1:start

25.1.0 Cairo component

The component Cairo (gb.cairo) is a 2D graphics library with support for multiple output media: images, PDF files, Postscript or SVG files. Cairo is designed to produce consistent output on all of the above output media while taking advantage of display hardware acceleration where available. The Cairo API provides operations similar to those for drawing from/to Postscript and PDF. Operations in Cairo include drawing and filling lines and areas, drawing third-degree Bézier curves, transforming and arranging images, and text rendering with anti-aliasing. All drawing operations can be transformed for each affine transformation such as scaling, translation, rotation or shearing via a matrix. In Cairo, drawing is vector-based. The Cairo component of Gambas adopts this method.

There are fundamental differences in the use of the methods between the Cairo component and the Paint class, for example in the surfaces on which drawing takes place or in the preparation of the brushes for drawing, even if the interfaces are very similar. With the methods of the Cairo class of the Cairo component of the same name (gb.cairo), drawing is mainly carried out with instruction sequences according to a fixed construction plan, because - similar to Paint - it is not freehand drawing.

B1

Figure 25.1.0.1: Circles and ellipses - drawn with methods of the Cairo class of the Cairo component

The main properties of the Cairo class are presented first and then its methods are described. Finally, the examples and projects presented and their description complete the practice-orientated approach to this topic. The presentation of properties and methods of other classes of the component complete the descriptions.

The Cairo component (gb.cairo) has the classes

  • Cairo
  • CairoExtents
  • CairoFontExtents
  • CairoTextExtents
  • CairoMatrix
  • CairoPattern
  • CairoSurface
  • CairoPdfSurface
  • CairoPsSurface
  • CairoSvgSurface
The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k25/k25.1/start.txt · Last modified: 21.02.2024 by emma

Page Tools