One Drawing, Placed Many Times

A logo on every page of a two-hundred-page document is the same drawing two hundred times. Written out in full each time, that is two hundred copies of the same instructions inside the file, and a document far heavier than it has any reason to be — which is noticed by whoever has to send it, never by whoever made it.

Here the name badge is described once and placed eight times, plus a ninth at half size, and the file carries one copy of it however many times it appears. Only the names differ from one badge to the next, so the names are drawn on the page over the badge rather than inside it. That line is the whole trick: keep everything that varies outside the shared drawing, and one copy goes on serving every badge on every page. A second page takes one badge further: it turns itself a quarter wherever it is placed, it says in a description of its own that it is a visitor badge, and it holds a file of its own, the guest list.

What This Example Shows

  • A drawing described once, then placed by naming it and saying where.
  • The same drawing placed at another size without describing it again.
  • Varying text drawn over the shared drawing, not inside it.

The Source Code, Complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.

Read the Rust source Read the Python source Read the JSON source

The Document Itself

Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese

Examples Near This One

Cutting out What You Draw

The same area of stripes shown through two windows: a plain disc, and a ring whose middle is left bare.

Transparency and Blend Modes

Half-transparent fills that overlap and mix, one orange square laid over a blue bar in four different ways of mixing colours, and a line of overlapping letters painted two ways.

Overlaps Mixed in Linear Light

A page that asks for its half-transparent colours to be mixed in linear light: two pairs of overlapping discs, each beside the colour its overlap should take and the one it takes when the request is ignored.

Gradients in a Line, in a Circle, and Read from a Function

Five panels: a header that fades out, the same fade on the diagonal, a glow carried past its own circle so the corners fill, a blend that goes by way of a third colour, and a checkerboard whose colour is worked out from where each point stands, redder to the right and greener towards the top.

Text and Shapes Filled with a Gradient

A gradient used as the colour something is filled with: a headline whose letters are windows onto a blend of three colours, a panel filled with a circular one that lets the page show through, and a band whose blend is stood upright and whose border is painted with the circular one.

Every example, by subject