Graphics Context - Canvas

The Canvas

The canvas is the surface onto which all images are drawn. I consists of a pixel array and all coordinates are in pixels. The current canvas can be accessed via the the Canvas datum when in the global data areas or within a share routine.

A new canvas can only be construct based on an existing pen, using the structure modification operator. The current default canvas is always constant.

The TCanvas Type

The TCanvas type is a system defined structure with the following fields :-

Number width

This determines the width of the canvas in pixels. The coordinates will be from 0 to width - 1.

Number height

This determines the height of the canvas in pixels. The coordinates will be from 0 to height - 1.

EImageMode mode

The canvas mode determines how the images are stored.

The options are :-

Picture - The image will be stored as a full colour image.

Pattern - The image will be stored just as pen and brush codes - the actual colours for these codes will be set when a pattern is drawn onto a picture canvas.

EColourMix colourmix

This will determine how colours mix when a pen or brush uses the 'Add' overwrite mode.

Paper - Colour mixing will be subtractive.

Screen - Colour mixing will be additive.

Initial Canvas

When a program starts running the system will create an initial canvas. The mode and size of this canvas will be determined by the command line arguments.

This canvas will be used for the final image file produced, so all shapes to be drawn will need to be written to this. It is however possible to create a temporary working canvas to produce an image that can then be extracted and drawn onto the main canvas.