Next: , Previous: Text-layout, Up: Class reference

8.3.15 Canvas class

A canvas object. It hosts the root of the VCL node tree, runs painters and handles the cooperation with GTK (events etc.).

It supports the object interface and the container interface.

     struct vcl_canvas * vcl_canvas_new (void)

Just creates a canvas.

     void vcl_canvas_setup (struct vcl_canvas *obj, int flags, real center_x,
                            real center_y, real unit_size)

Sets miscellaneous canvas parameters. center_x and center_y specify the relative center of the canvas – this point is fixed when resizing the canvas and it is the implicit position of mathvcl11. Passing the mathvcl12 values associates the center with the real center. unit_size is a multiplier for units and the flags are these:

the base unit is a millimeter instead of a pixel.
The GTK widget allocates full width for the bounding box of the root node instead of a flexible size.
Flip the X axis (instead of X increasing in left-right direction)
Flip the Y axis (instead of Y increasing in the up-down direction)
     void vcl_canvas_set_root (struct vcl_canvas *obj, void * root)

Sets the root node. The same rules as in vcl_enclosure_set_child apply.

     void * vcl_canvas_get_root (struct vcl_canvas *obj)

Returns the root node.