A cell repeated to fill a shape

Draw one small cell and have it laid down over and over to fill a shape: hatching, a weave, a background of dots.

In plain words

Written for anybody. It says what this puts on a sheet of paper, and asks nothing of you beyond that.

Think of a tiled floor. You do not draw every tile: you draw one, and you say how far apart they sit. Here it is the same. You draw a small cell — a bar, a dot, a cross — you say how far apart the cells go across and up, and any shape you fill with that name is covered by the cell repeated. It costs the file one cell however large the shape is. Put the cells further apart than the cell is wide and you get gaps between them; closer, and they overlap, the later one over the earlier. A cell that never moves is refused: it would be laid down for ever in the same place.

For a developer

Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.

Written at the top level of a request, under "tilings"

tilings declares the repeating cells the document defines for itself, each under the name a shape's fill selects it by. box is the part of the cell's own space that is laid down, and nothing outside it is drawn. step is how far apart the cells are placed, across and up: wider than the box leaves a gap, narrower overlaps them, and a step of nothing at all is refused. colored says whether the cell states its own colours — a cell that does not takes the colour of whatever fills with it, which is what lets one hatching serve in any colour. spacing says how a reader may trade the step against the cell, and absent keeps the step exact. A name declared twice keeps the last.

Every key, with its default

The reference: which keys are required, which are optional, what each one defaults to and which combinations the server declines.

  • tilings — array, optional, empty by default.
  • tilings[].name — string, required. The name a fill selects this cell by. A name declared twice keeps the last.
  • tilings[].box — object, required, of x, y, width and height. The part of the cell's own space that is laid down.
  • tilings[].step — array of two numbers, required. How far apart the cells are placed, across and up. A step of nothing at all is refused.
  • tilings[].colored — boolean, optional, true by default. Whether the cell states its own colours. A cell that does not takes the colour of whatever fills with it, which is what lets one hatching serve in any colour.
  • tilings[].spacing — string, optional. How a reader may trade the step against the cell: constant, undistorted, constant_and_fast. Absent keeps the step exact.
  • tilings[].items — array, required. The shapes the cell is made of, in the order they are drawn, as a declared drawing takes them.
  • tilings[].matrix — array of six numbers, optional. What the tiled plane's own space is, in the page's space. Absent tiles it in the page's own space, so a hatch is slanted by mapping the plane rather than by drawing a slanted cell.

Scope: the whole document. A shape reaches a cell by naming it where it would name a colour, and the cell is laid down in page coordinates, so two shapes filled with the same cell line up with each other.

A whole request that draws it

Post this as it stands and a PDF comes back. Nothing has been left out of it.

{
  "tilings": [
    {
      "name": "upright",
      "box": { "x": 0, "y": 0, "width": 8, "height": 8 },
      "step": [8, 8],
      "items": [
        {
          "type": "rect",
          "rect": { "llx": 0, "lly": 0, "urx": 3, "ury": 8 },
          "fill": [0.12, 0.28, 0.52]
        }
      ]
    }
  ],
  "items": [
    {
      "type": "rect",
      "rect": { "llx": 72, "lly": 600, "urx": 320, "ury": 740 },
      "fill": { "pattern": "upright" }
    }
  ]
}

The line that sends it, in three languages

Colour and how it is shown

The device the colours are stated for Declaring colour beyond red, green and blue A colour sliding into another Opacity and how colours mix The space a page mixes its colours in

Where to go next

Every key of a request, in one page The other thirty-two settings of a request

See the prices See the examples