Memory Management
- All canvas items are refcountable, they have a protected destructor, so they can't be placed on the stack or embedded.
- Child items are owned by their parent items, floating reference count after initial creation, and parents ref_sink() their children.
- The top-level canvas/root item is owned by the user, if he does not unref it at some point, it'll be leaked.
Signalling
Each item supports sending events. To make items more efficient, the client can choose whether he requires a specific event and mask it out. Events are also used internally as the surface invalidation mechanism.
SVG-Support
SVG-Support is also implemented.
Implementation
class Item : ReferenceCountImpl {
void render (Plane &plane);
[...]
};
class Rectangle : public Item; // supports feather edge
class PolyItem : public Item; // supports feather edge
class Image : public Item;
class CairoItem : public Item {
void move_to (double x, double y);
void line_to (double x, double y);
[...]
};
class SVGItem : public Item {
bool parse_svg_file (const char *filename);
String get_error();
[...]
};