<div dir="ltr">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.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 19, 2015 at 1:15 AM, Lawrence D'Oliveiro <span dir="ltr"><<a href="mailto:ldo@geek-central.gen.nz" target="_blank">ldo@geek-central.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Do people find the existing Cairo tutorial<br>
<<a href="http://cairographics.org/tutorial/" rel="noreferrer" target="_blank">http://cairographics.org/tutorial/</a>> useful? I don’t feel it jibes with<br>
how I learned to understand Cairo. Rather, I made sense of it in terms<br>
of the interrelationships of the principal object types:<br>
<br>
* a *surface* is the recipient of drawing operations. There are various<br>
  types of surfaces, in particular an *image surface* is a rectangular<br>
  array of pixels, which can be of various formats.<br>
<br>
  Other surface types have their uses, for example PDF and SVG<br>
  surfaces allow the direct creation of those file formats with Cairo<br>
  drawing operations, such that the original object geometry (including<br>
  text font outlines) is preserved as far as possible, rather than being<br>
  rendered to pixels at some fixed resolution.<br>
<br>
* a *context* is the holder of state for drawing operations. It keeps<br>
  information needed during drawing, but which is no longer needed once<br>
  the final image has been produced, such as the colour/pattern to use<br>
  for drawing, the font to use for text, and so on.<br>
<br>
* a *pattern* supplies the information for affecting pixel values<br>
  during drawing. It can be as simple as a single uniform colour<br>
  (in this case, Cairo provides convenience routines to set the source<br>
  colour for drawing directly, rather than having to explicitly create a<br>
  pattern object first), or it can be a more elaborate gradient or mesh<br>
  pattern, or it can even consist of the image from another surface.<br>
<br>
* a *font face* is the Cairo object for loading fonts to use for<br>
  rendering text.<br>
<br>
* a *scaled font* is the user-visible part of Cairo’s font-caching<br>
  mechanism. It represents a font with a particular transformation and<br>
  rendering options selected. If you use a number of different<br>
  font settings repeatedly, then obtaining and setting scaled fonts is a<br>
  quicker way of switching among these settings when rendering text than<br>
  specifying the font face and size and other options separately every<br>
  time.<br>
<br>
As I see it, those are the most important ones to get straight. Once<br>
you grasp those concepts, the rest makes a whole lot more sense.<br>
<span class="HOEnZb"><font color="#888888">--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a></font></span></blockquote></div><br></div>