Expand/Shrink

cdCanvas

Definition: include pGUI.e

cdCanvas identifier
Description: Type. An integer > 0.

Use this to define CanvasDraw canvas variables. It is probably unwise to use this to determine whether an object is a cdCanvas, as many things which are clearly not (eg 1, 5000, 'X') will pass.

The type cdCanvan is the same but also allows null.
pwa/p2js: Supported. Or at least understood by pwa/p2js and mapped to "/* cdCanvas */", there isn’t actually a cdCanvas() in pGUI.js, in line with the notes above, ditto cdCanvan. As yet, however, there is no (such) handling of imImage or cdContext, not that they would be difficult to add, though obviously there are some concerns about reading a disk file that bring the need for imImage into doubt, and there are somewhat dummy CD_GL = "CD_GL" and CD_IUP = "CD_IUP" constants in pGUI.js which bring the need for an explicit cdContext type into similar doubt.
Comments: The type imImage (see eg IupLoadImage()) is defined in a near-identical fashion, but obviously used for different purposes. It allows null (there is no imImagn type).
The type cdContext (see cdCreateCanvas()) is also logically quite similar, though that can also have human-readable values.
Example:
include pGUI.e

cdCanvas canvas = cdCreateCanvas(CD_IUP, IupCanvas())
See Also: IupCanvas, cdCreateCanvas