Next: , Previous: Mask interface, Up: Interface reference

8.2.6 Node interface

This interface is responsible for binding objects to the VCL node tree. It contains private methods needed to connect individual objects to the tree.

Every object implementing the node interface must also implement the object interface and one of the container, mask, or shape interfaces.

Every node connected to the tree (the root node of the canvas or a node with a parent) is responsible for calling change propagation methods of its parent to participate in change propagation.

Tree binding methods

These four private methods need to be implemented for the node to be able to be connected to the tree. The last one (_get_parent) could be considered public. The node is required to store a pointer to its parent and some key value identifying it. _set functions should only be called by a container having or acquiring a node as its child. The creation of parent-child connection is done by calling appropriate public methods of the parent; and from the code of that method the _set_parent method with new the parent pointer is called on the child.

     vcl_node_set_data (void *obj, int x)
     vcl_node_get_data (void *obj)
     vcl_node_set_parent (void *obj, void * parent)
     vcl_node_get_parent (void *obj)

Transformation functions

There are four public functions for getting transformations from the obj's children coordinate space to the pixel coordinate space (primary functions) and from the pixel coordinate space to the obj's children coordinate space (inverted functions). These functions are not methods of the node interface (so a class implementing the node interface does not implement these functions) but can be called on any nodes (as the first argument). _apply_point applies the given transformation to one struct geom_point, _apply_matrix applies the given transformation to one struct geom_transform. For transforming more points it may be faster to get one struct geom_transform (by supplying the _apply_matrix function with identity) and then transform every point with it.

The return values of this functions are error values (where zero means OK) with the same meaning as standard error values of GEOMLIB.

     int vcl_primary_apply_matrix (void * obj, struct geom_transform *dst)
     int vcl_inverted_apply_matrix (void * obj, struct geom_transform *dst)
     int vcl_primary_apply_point (void * obj, struct geom_point *dst)
     int vcl_inverted_apply_point (void * obj, struct geom_point *dst)