Grid

The grid statement defines the size of the canvas. It is required and must appear exactly once in every program.

Syntax

grid <width> by <height>

Both width and height are positive integers. They define how many pixels the canvas has along each axis.

Examples

grid 17 by 17     // 17x17 square canvas
grid 32 by 64     // 32 wide, 64 tall
grid 128 by 128   // large canvas

Coordinate system

The origin (0, 0) is at the top-left corner. The x axis increases to the right, and the y axis increases downward.

(0,0) ---- x --->
  |
  y
  |
  v

Valid pixel positions range from (0, 0) to (width - 1, height - 1). Expressions are evaluated for every position in this range.

Validation