Expand/Shrink

cdCanvasClear

Definition: include pGUI.e

cdCanvasClear(cdCanvas canvas)
Description: Clears the active canvas using the current background color.

This action is interpreted very differently by each driver.
Many drivers simply draw a rectangle with the current background color.
It is not necessary to call cdCanvasClear when the canvas has just been created, as at this moment it is already clean (CD_WHITE), unless you set a different background colour.
Most file-based drivers do not implement this function.

The cdClear() function that did not require an explicit canvas to be passed ceased to be available in version 3.25.
pwa/p2js: Supported, apart from the state functions.
Auxillary functions: cdCanvasFlush(cdCanvas canvas)

Has a different meaning for each driver.
It is useful to send information to buffered devices and to move to a new page or layer.
In all cases, the current canvas attributes are preserved.

atom pCdState = cdCanvasSaveState(cdCanvas canvas)

Saves the state of attributes of the active canvas.
It does not save cdPlay callbacks, polygon creation states (begin/vertex/vertex/...), the palette, complex clipping regions and driver internal attributes.
The result should be considered an opaque pointer, suitable only for passing to the following two functions.

cdCanvasRestoreState(cdCanvas canvas, atom pCdState)

Restores the attribute state of the active canvas.
It can be used between canvases of different contexts.
It can be used several times for the same state.

cdReleaseState(atom pCdState)

Releases the memory allocated by the cdCanvasSaveState function.