[cairo] Cairo Tutorial

Colin William Brown colinwilliambrown at gmail.com
Sun Nov 22 09:27:05 PST 2015


I think a good teaching document needs to come at the subject from the two
perspectives: the relationships among principle object types and the
mechanism for actually using them. Seeing only one dimension can leave me
floundering.

On Thu, Nov 19, 2015 at 1:15 AM, Lawrence D'Oliveiro <
ldo at geek-central.gen.nz> wrote:

> Do people find the existing Cairo tutorial
> <http://cairographics.org/tutorial/> useful? I don’t feel it jibes with
> how I learned to understand Cairo. Rather, I made sense of it in terms
> of the interrelationships of the principal object types:
>
> * a *surface* is the recipient of drawing operations. There are various
>   types of surfaces, in particular an *image surface* is a rectangular
>   array of pixels, which can be of various formats.
>
>   Other surface types have their uses, for example PDF and SVG
>   surfaces allow the direct creation of those file formats with Cairo
>   drawing operations, such that the original object geometry (including
>   text font outlines) is preserved as far as possible, rather than being
>   rendered to pixels at some fixed resolution.
>
> * a *context* is the holder of state for drawing operations. It keeps
>   information needed during drawing, but which is no longer needed once
>   the final image has been produced, such as the colour/pattern to use
>   for drawing, the font to use for text, and so on.
>
> * a *pattern* supplies the information for affecting pixel values
>   during drawing. It can be as simple as a single uniform colour
>   (in this case, Cairo provides convenience routines to set the source
>   colour for drawing directly, rather than having to explicitly create a
>   pattern object first), or it can be a more elaborate gradient or mesh
>   pattern, or it can even consist of the image from another surface.
>
> * a *font face* is the Cairo object for loading fonts to use for
>   rendering text.
>
> * a *scaled font* is the user-visible part of Cairo’s font-caching
>   mechanism. It represents a font with a particular transformation and
>   rendering options selected. If you use a number of different
>   font settings repeatedly, then obtaining and setting scaled fonts is a
>   quicker way of switching among these settings when rendering text than
>   specifying the font face and size and other options separately every
>   time.
>
> As I see it, those are the most important ones to get straight. Once
> you grasp those concepts, the rest makes a whole lot more sense.
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20151122/5cba0640/attachment.html>


More information about the cairo mailing list