![]() |
![]() |
![]() |
GooCanvas Reference Manual | ![]() |
---|
Creating New ItemsCreating New Items — how to create new canvas items. |
There are 3 ways to create new canvas items, listed here in increasing order of complexity:
These will be discussed in turn below. (It is also possible to create new container items by subclassing GooCanvasGroup, but that is not covered here.)
The final part of this section covers creating item models.
For items that consist of a simple graphic element such
as a line, rectangle or circle, it is possible to create a subclass
of GooCanvasItemSimple and override just one method,
simple_create_path()
. (This method is used for the GooCanvasEllipse
and GooCanvasPath items.)
The simple_create_path()
method should create a path using the given
cairo context. The path will be drawn using the stroke, fill and
other painting properties from GooCanvasItemSimple.
This example shows the simple_create_path()
method for a simple
rectangular item, MyItem:
1 2 3 4 5 6 7 8 9 10 11 |