Graphics Context - Origin

The Origin

The graphics context origin is used to set where on the canvas a shape is drawn. The origin has type Point but only the 'x' and 'y' fields are used.

When a program starts the origin is initialised to {0, 0, 0}. When a shape routine is called the value is offset by the point specified in the drawing statement's graphics context ( if specified ). The offset can be positive or negative. This offsetting process is repeated as shapes call other shapes.

With a shape routine all coordinate are relative to this point ( except where over-ridden by a With statement ). Thus it is possible to write shape routines that will automatically shift as a block to a specified location.

Within a shape routine the origin can be accessed as the Origin datum, which is a constant. It is, however, very rare to access it directly.

When specifying an origin in a drawing call the origin can be written as a literal structure ( e.g. { 100, 50 } ) as will as with any expression that yields a Point result.

	MyShape(20) => {100, 100};