![]() |
![]() |
![]() |
GooCanvas Reference Manual | |
---|---|---|---|---|
#include <goocanvas.h> GooCanvasBounds; enum GooCanvasItemVisibility; enum GooCanvasPointerEvents; enum GooCanvasAnimateType; GooCanvasStyle; enum GooCanvasStyleValuesMask; GooCanvasStyle* goo_canvas_style_new (void); GooCanvasStyle* goo_canvas_style_ref (GooCanvasStyle *style); void goo_canvas_style_unref (GooCanvasStyle *style); GooCanvasPoints; GooCanvasPoints* goo_canvas_points_new (int num_points); GooCanvasPoints* goo_canvas_points_ref (GooCanvasPoints *points); void goo_canvas_points_unref (GooCanvasPoints *points); GooCanvasLineDash; GooCanvasLineDash* goo_canvas_line_dash_new (gint num_dashes, ...); GooCanvasLineDash* goo_canvas_line_dash_newv (gint num_dashes, double *dashes); GooCanvasLineDash* goo_canvas_line_dash_ref (GooCanvasLineDash *dash); void goo_canvas_line_dash_unref (GooCanvasLineDash *dash);
typedef struct { gdouble x1, y1, x2, y2; } GooCanvasBounds;
GooCanvasBounds represents the bounding box of an item in the canvas.
gdouble x1 ; |
the left edge. |
gdouble y1 ; |
the top edge. |
gdouble x2 ; |
the right edge. |
gdouble y2 ; |
the bottom edge. |
typedef enum { GOO_CANVAS_ITEM_VISIBLE, GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD, GOO_CANVAS_ITEM_INVISIBLE } GooCanvasItemVisibility;
The GooCanvasItemVisibility enumeration is used to specify when a canvas item is visible.
typedef enum { /* If the item must be visible to receive events. */ GOO_CANVAS_EVENTS_VISIBLE_MASK = 1 << 0, /* If the fill or stroke must be painted to receive events. */ GOO_CANVAS_EVENTS_PAINTED_MASK = 1 << 1, /* If the fill should receive events. */ GOO_CANVAS_EVENTS_FILL_MASK = 1 << 2, /* If the stroke should receive events. */ GOO_CANVAS_EVENTS_STROKE_MASK = 1 << 3, GOO_CANVAS_EVENTS_NONE = 0, GOO_CANVAS_EVENTS_VISIBLE_PAINTED = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_PAINTED_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK, GOO_CANVAS_EVENTS_VISIBLE_FILL = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_FILL_MASK, GOO_CANVAS_EVENTS_VISIBLE_STROKE = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_STROKE_MASK, GOO_CANVAS_EVENTS_VISIBLE = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK, GOO_CANVAS_EVENTS_PAINTED = GOO_CANVAS_EVENTS_PAINTED_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK, GOO_CANVAS_EVENTS_FILL = GOO_CANVAS_EVENTS_FILL_MASK, GOO_CANVAS_EVENTS_STROKE = GOO_CANVAS_EVENTS_STROKE_MASK, GOO_CANVAS_EVENTS_ALL = GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK } GooCanvasPointerEvents;
Specifies when an item receives pointer events such as mouse clicks.
typedef enum { GOO_CANVAS_ANIMATE_FREEZE, GOO_CANVAS_ANIMATE_RESET, GOO_CANVAS_ANIMATE_RESTART, GOO_CANVAS_ANIMATE_BOUNCE } GooCanvasAnimateType;
GooCanvasAnimateType is used to specify what happens when the end of an animation is reached.
typedef struct { int ref_count; /* This specifies which fields are actually set. If the STROKE_PATTERN bit is set, and stroke_pattern is NULL, no stroke will be drawn. */ GooCanvasStyleValuesMask mask; cairo_pattern_t *stroke_pattern; cairo_pattern_t *fill_pattern; double line_width, line_join_miter_limit; GooCanvasLineDash *dash; /* We use bitmasks here to cut down on memory use a bit. I've given each field a few bits more than it needs to allow for new values. */ cairo_fill_rule_t fill_rule : 3; cairo_operator_t op : 6; cairo_antialias_t antialias : 4; cairo_line_cap_t line_cap : 4; cairo_line_join_t line_join : 4; } GooCanvasStyle;
GooCanvasStyle describes the style in which an item is to be drawn, e.g. its stroke and fill colors or patterns, and its line width and style.
int ref_count ; |
the reference count of the struct. |
GooCanvasStyleValuesMask mask ; |
a mask specifying which fields of the GooCanvasStyle have been set. |
cairo_pattern_t *stroke_pattern ; |
the stroke pattern (or color). |
cairo_pattern_t *fill_pattern ; |
the fill pattern (or color). |
double line_width ; |
the line width. |
double line_join_miter_limit ; |
the minimum angle in degrees at which the miter join style will be used. For smaller angles a bevel join is used instead. |
GooCanvasLineDash *dash ; |
the dash pattern. |
cairo_fill_rule_t fill_rule : 3; |
the fill rule. |
cairo_operator_t op : 6; |
the drawing operator. |
cairo_antialias_t antialias : 4; |
the type of antialiasing to do. |
cairo_line_cap_t line_cap : 4; |
the line cap style. |
cairo_line_join_t line_join : 4; |
the line join style. |
typedef enum { GOO_CANVAS_STYLE_STROKE_PATTERN = 1 << 0, GOO_CANVAS_STYLE_FILL_PATTERN = 1 << 1, GOO_CANVAS_STYLE_FILL_RULE = 1 << 2, GOO_CANVAS_STYLE_OPERATOR = 1 << 3, GOO_CANVAS_STYLE_ANTIALIAS = 1 << 4, GOO_CANVAS_STYLE_LINE_WIDTH = 1 << 5, GOO_CANVAS_STYLE_LINE_CAP = 1 << 6, GOO_CANVAS_STYLE_LINE_JOIN = 1 << 7, GOO_CANVAS_STYLE_LINE_JOIN_MITER_LIMIT = 1 << 8, GOO_CANVAS_STYLE_LINE_DASH = 1 << 9 } GooCanvasStyleValuesMask;
Specifies which fields of a GooCanvasStyle object have been set.
GooCanvasStyle* goo_canvas_style_new (void);
Creates a new GooCanvasStyle, using the default settings.
Returns : | a new GooCanvasStyle. |
GooCanvasStyle* goo_canvas_style_ref (GooCanvasStyle *style);
Increments the reference count of a GooCanvasStyle.
style : |
a GooCanvasStyle. |
Returns : | the GooCanvasStyle. |
void goo_canvas_style_unref (GooCanvasStyle *style);
Decrements the reference count of the GooCanvasStyle. If the reference count falls to 0, the GooCanvasStyle is freed.
style : |
a GooCanvasStyle. |
typedef struct { double *coords; int num_points; int ref_count; } GooCanvasPoints;
GooCairoPoints represents an array of points.
double *coords ; |
the coordinates of the points, in pairs. |
int num_points ; |
the number of points. |
int ref_count ; |
the reference count of the struct. |
GooCanvasPoints* goo_canvas_points_new (int num_points);
Creates a new GooCanvasPoints struct with space for the given number of
points. It should be freed with goo_canvas_points_unref()
.
num_points : |
the number of points to create space for. |
Returns : | a new GooCanvasPoints struct. |
GooCanvasPoints* goo_canvas_points_ref (GooCanvasPoints *points);
Increments the reference count of the given GooCanvasPoints struct.
points : |
a GooCanvasPoints struct. |
Returns : | the GooCanvasPoints struct. |
void goo_canvas_points_unref (GooCanvasPoints *points);
Decrements the reference count of the given GooCanvasPoints struct, freeing it if the reference count falls to zero.
points : |
a GooCanvasPoints struct. |
typedef struct { int ref_count; int num_dashes; double *dashes; double dash_offset; } GooCanvasLineDash;
GooCanvasLineDash specifies a dash pattern to be used when drawing items.
int ref_count ; |
the reference count of the struct. |
int num_dashes ; |
the number of dashes and gaps between them. |
double *dashes ; |
the sizes of each dash and gap. |
double dash_offset ; |
the start offset into the dash pattern. |
GooCanvasLineDash* goo_canvas_line_dash_new (gint num_dashes, ...);
Creates a new dash pattern.
num_dashes : |
the number of dashes and gaps in the pattern. |
... : |
the length of each dash and gap. |
Returns : | a new dash pattern. |
GooCanvasLineDash* goo_canvas_line_dash_newv (gint num_dashes, double *dashes);
Creates a new dash pattern. Takes ownership of the dashes
vector.
num_dashes : |
the number of dashes and gaps in the pattern. |
dashes : |
a g_new-allocated vector of doubles, the length of each dash and gap. |
Returns : | a new dash pattern. |
GooCanvasLineDash* goo_canvas_line_dash_ref (GooCanvasLineDash *dash);
Increments the reference count of the dash pattern.
dash : |
a GooCanvasLineDash. |
Returns : | the dash pattern. |
void goo_canvas_line_dash_unref (GooCanvasLineDash *dash);
Decrements the reference count of the dash pattern. If it falls to 0 it is freed.
dash : |
a GooCanvasLineDash. |