GooCanvas Types

GooCanvas Types — types used in GooCanvas.

Synopsis

struct              GooCanvasBounds;

enum                GooCanvasItemVisibility;

enum                GooCanvasPointerEvents;

enum                GooCanvasAnimateType;

enum                GooCanvasAnchorType;

struct              GooCanvasPoints;
GooCanvasPoints *   goo_canvas_points_new               (int num_points);
void                goo_canvas_points_get_point         (GooCanvasPoints *points,
                                                         int idx,
                                                         double *x,
                                                         double *y);
void                goo_canvas_points_set_point         (GooCanvasPoints *points,
                                                         int idx,
                                                         double x,
                                                         double y);
GooCanvasPoints *   goo_canvas_points_ref               (GooCanvasPoints *points);
void                goo_canvas_points_unref             (GooCanvasPoints *points);

struct              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);

enum                GooCanvasPathCommandType;
union               GooCanvasPathCommand;
GArray *            goo_canvas_parse_path_data          (const gchar *path_data);
void                goo_canvas_create_path              (GArray *commands,
                                                         cairo_t *cr);

typedef             GooCairoAntialias;
typedef             GooCairoFillRule;
typedef             GooCairoHintMetrics;
typedef             GooCairoLineCap;
typedef             GooCairoLineJoin;
typedef             GooCairoOperator;
typedef             GooCairoMatrix;
typedef             GooCairoPattern;

Object Hierarchy

  GEnum
   +----GooCanvasItemVisibility
  GFlags
   +----GooCanvasPointerEvents
  GEnum
   +----GooCanvasAnimateType
  GEnum
   +----GooCanvasAnchorType
  GBoxed
   +----GooCanvasPoints
  GBoxed
   +----GooCanvasLineDash
  GEnum
   +----GooCanvasPathCommandType
  GEnum
   +----GooCairoAntialias
  GEnum
   +----GooCairoFillRule
  GEnum
   +----GooCairoHintMetrics
  GEnum
   +----GooCairoLineCap
  GEnum
   +----GooCairoLineJoin
  GEnum
   +----GooCairoOperator
  GBoxed
   +----GooCairoMatrix
  GBoxed
   +----GooCairoPattern

Description

This section describes the types used throughout GooCanvas.

Details

struct GooCanvasBounds

struct GooCanvasBounds {
  gdouble x1, y1, x2, y2;
};

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.

enum GooCanvasItemVisibility

typedef enum {
  GOO_CANVAS_ITEM_HIDDEN			= 0,
  GOO_CANVAS_ITEM_INVISIBLE			= 1,
  GOO_CANVAS_ITEM_VISIBLE			= 2,
  GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD = 3
} GooCanvasItemVisibility;

GOO_CANVAS_ITEM_HIDDEN: the item is invisible, and is not allocated any space in layout container items such as GooCanvasTable. GOO_CANVAS_ITEM_INVISIBLE: the item is invisible, but it is still allocated space in layout container items. GOO_CANVAS_ITEM_VISIBLE: the item is visible. GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD: the item is visible when the canvas scale setting is greater than or equal to the item's visibility threshold setting.

The GooCanvasItemVisibility enumeration is used to specify when a canvas item is visible.


enum GooCanvasPointerEvents

typedef enum {
  GOO_CANVAS_EVENTS_VISIBLE_MASK = 1 << 0,
  GOO_CANVAS_EVENTS_PAINTED_MASK = 1 << 1,
  GOO_CANVAS_EVENTS_FILL_MASK		= 1 << 2,
  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;

GOO_CANVAS_EVENTS_VISIBLE_MASK: a mask indicating that the item only receives events when it is visible. GOO_CANVAS_EVENTS_PAINTED_MASK: a mask indicating that the item only receives events when the specified parts of it are painted. GOO_CANVAS_EVENTS_FILL_MASK: a mask indicating that the filled part of the item receives events. GOO_CANVAS_EVENTS_STROKE_MASK: a mask indicating that the stroked part of the item receives events. GOO_CANVAS_EVENTS_NONE: the item doesn't receive events at all. GOO_CANVAS_EVENTS_VISIBLE_PAINTED: the item receives events in its painted areas when it is visible (the default). GOO_CANVAS_EVENTS_VISIBLE_FILL: the item's interior receives events when it is visible. GOO_CANVAS_EVENTS_VISIBLE_STROKE: the item's perimeter receives events when it is visible. GOO_CANVAS_EVENTS_VISIBLE: the item receives events when it is visible, whether it is painted or not. GOO_CANVAS_EVENTS_PAINTED: the item receives events in its painted areas, whether it is visible or not. GOO_CANVAS_EVENTS_FILL: the item's interior receives events, whether it is visible or painted or not. GOO_CANVAS_EVENTS_STROKE: the item's perimeter receives events, whether it is visible or painted or not. GOO_CANVAS_EVENTS_ALL: the item's perimeter and interior receive events, whether it is visible or painted or not.

Specifies when an item receives pointer events such as mouse clicks.


enum GooCanvasAnimateType

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.

GOO_CANVAS_ANIMATE_FREEZE

the item remains in the final position.

GOO_CANVAS_ANIMATE_RESET

the item is moved back to the initial position.

GOO_CANVAS_ANIMATE_RESTART

the animation is restarted from the initial position.

GOO_CANVAS_ANIMATE_BOUNCE

the animation bounces back and forth between the start and end positions.

enum GooCanvasAnchorType

typedef enum {
  GOO_CANVAS_ANCHOR_CENTER,
  GOO_CANVAS_ANCHOR_NORTH,
  GOO_CANVAS_ANCHOR_NORTH_WEST,
  GOO_CANVAS_ANCHOR_NORTH_EAST,
  GOO_CANVAS_ANCHOR_SOUTH,
  GOO_CANVAS_ANCHOR_SOUTH_WEST,
  GOO_CANVAS_ANCHOR_SOUTH_EAST,
  GOO_CANVAS_ANCHOR_WEST,
  GOO_CANVAS_ANCHOR_EAST,
  GOO_CANVAS_ANCHOR_N		= GOO_CANVAS_ANCHOR_NORTH,
  GOO_CANVAS_ANCHOR_NW		= GOO_CANVAS_ANCHOR_NORTH_WEST,
  GOO_CANVAS_ANCHOR_NE		= GOO_CANVAS_ANCHOR_NORTH_EAST,
  GOO_CANVAS_ANCHOR_S		= GOO_CANVAS_ANCHOR_SOUTH,
  GOO_CANVAS_ANCHOR_SW		= GOO_CANVAS_ANCHOR_SOUTH_WEST,
  GOO_CANVAS_ANCHOR_SE		= GOO_CANVAS_ANCHOR_SOUTH_EAST,
  GOO_CANVAS_ANCHOR_W		= GOO_CANVAS_ANCHOR_WEST,
  GOO_CANVAS_ANCHOR_E		= GOO_CANVAS_ANCHOR_EAST
} GooCanvasAnchorType;

GOO_CANVAS_ANCHOR_CENTER: the anchor is in the center of the object. GOO_CANVAS_ANCHOR_NORTH: the anchor is at the top of the object, centered horizontally. GOO_CANVAS_ANCHOR_NORTH_WEST: the anchor is at the top-left of the object. GOO_CANVAS_ANCHOR_NORTH_EAST: the anchor is at the top-right of the object. GOO_CANVAS_ANCHOR_SOUTH: the anchor is at the bottom of the object, centered horizontally. GOO_CANVAS_ANCHOR_SOUTH_WEST: the anchor is at the bottom-left of the object. GOO_CANVAS_ANCHOR_SOUTH_EAST: the anchor is at the bottom-right of the object. GOO_CANVAS_ANCHOR_WEST: the anchor is on the left of the object, centered vertically. GOO_CANVAS_ANCHOR_EAST: the anchor is on the right of the object, centered vertically. GOO_CANVAS_ANCHOR_N: see GOO_CANVAS_ANCHOR_NORTH. GOO_CANVAS_ANCHOR_NW: see GOO_CANVAS_ANCHOR_NORTH_WEST. GOO_CANVAS_ANCHOR_NE: see GOO_CANVAS_ANCHOR_NORTH_EAST. GOO_CANVAS_ANCHOR_S: see GOO_CANVAS_ANCHOR_SOUTH. GOO_CANVAS_ANCHOR_SW: see GOO_CANVAS_ANCHOR_SOUTH_WEST. GOO_CANVAS_ANCHOR_SE: see GOO_CANVAS_ANCHOR_SOUTH_EAST. GOO_CANVAS_ANCHOR_W: see GOO_CANVAS_ANCHOR_WEST. GOO_CANVAS_ANCHOR_E: see GOO_CANVAS_ANCHOR_EAST.

GooCanvasAnchorType is used to specify the positions of objects relative to a particular anchor point.


struct GooCanvasPoints

struct GooCanvasPoints {
  double *coords;
  int num_points;
  int ref_count;
};

coords: the coordinates of the points, in pairs. num_points: the number of points. ref_count: the reference count of the struct.

GooCairoPoints represents an array of points.


goo_canvas_points_new ()

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. [transfer full]

goo_canvas_points_get_point ()

void                goo_canvas_points_get_point         (GooCanvasPoints *points,
                                                         int idx,
                                                         double *x,
                                                         double *y);

Gets the coordinates of a point in the GooCanvasPoints struct.

points :

a GooCanvasPoints struct.

idx :

index of point to get.

x :

location to store x coordinate. [out]

y :

location to store y coordinate. [out]

Since 2.0.1


goo_canvas_points_set_point ()

void                goo_canvas_points_set_point         (GooCanvasPoints *points,
                                                         int idx,
                                                         double x,
                                                         double y);

Sets the coordinates of a point in the GooCanvasPoints struct.

points :

a GooCanvasPoints struct.

idx :

index of point to set.

x :

x value to set point coordinate to.

y :

y value to set point coordinate to.

Since 2.0.1


goo_canvas_points_ref ()

GooCanvasPoints *   goo_canvas_points_ref               (GooCanvasPoints *points);

Increments the reference count of the given GooCanvasPoints struct.

points :

a GooCanvasPoints struct.

Returns :

the GooCanvasPoints struct.

goo_canvas_points_unref ()

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.

struct GooCanvasLineDash

struct GooCanvasLineDash {
  int ref_count;
  int num_dashes;
  double *dashes;
  double dash_offset;
};

ref_count: the reference count of the struct. num_dashes: the number of dashes and gaps between them. dashes: the sizes of each dash and gap. dash_offset: the start offset into the dash pattern.

GooCanvasLineDash specifies a dash pattern to be used when drawing items.


goo_canvas_line_dash_new ()

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.

goo_canvas_line_dash_newv ()

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.

goo_canvas_line_dash_ref ()

GooCanvasLineDash * goo_canvas_line_dash_ref            (GooCanvasLineDash *dash);

Increments the reference count of the dash pattern.

dash :

a GooCanvasLineDash.

Returns :

the dash pattern.

goo_canvas_line_dash_unref ()

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.

enum GooCanvasPathCommandType

typedef enum {
  /* Simple commands like moveto and lineto: MmZzLlHhVv. */
  GOO_CANVAS_PATH_MOVE_TO,
  GOO_CANVAS_PATH_CLOSE_PATH,
  GOO_CANVAS_PATH_LINE_TO,
  GOO_CANVAS_PATH_HORIZONTAL_LINE_TO,
  GOO_CANVAS_PATH_VERTICAL_LINE_TO,

  /* Bezier curve commands: CcSsQqTt. */
  GOO_CANVAS_PATH_CURVE_TO,
  GOO_CANVAS_PATH_SMOOTH_CURVE_TO,
  GOO_CANVAS_PATH_QUADRATIC_CURVE_TO,
  GOO_CANVAS_PATH_SMOOTH_QUADRATIC_CURVE_TO,

  /* The elliptical arc commands: Aa. */
  GOO_CANVAS_PATH_ELLIPTICAL_ARC
} GooCanvasPathCommandType;

GOO_CANVAS_PATH_MOVE_TO: move to the given point. GOO_CANVAS_PATH_CLOSE_PATH: close the current path, drawing a line from the current position to the start of the path. GOO_CANVAS_PATH_LINE_TO: draw a line to the given point. GOO_CANVAS_PATH_HORIZONTAL_LINE_TO: draw a horizontal line to the given x coordinate. GOO_CANVAS_PATH_VERTICAL_LINE_TO: draw a vertical line to the given y coordinate. GOO_CANVAS_PATH_CURVE_TO: draw a bezier curve using two control points to the given point. GOO_CANVAS_PATH_SMOOTH_CURVE_TO: draw a bezier curve using a reflection of the last control point of the last curve as the first control point, and one new control point, to the given point. GOO_CANVAS_PATH_QUADRATIC_CURVE_TO: draw a quadratic bezier curve using a single control point to the given point. GOO_CANVAS_PATH_SMOOTH_QUADRATIC_CURVE_TO: draw a quadratic bezier curve using a reflection of the control point from the previous curve as the control point, to the given point. GOO_CANVAS_PATH_ELLIPTICAL_ARC: draw an elliptical arc, using the given 2 radii, the x axis rotation, and the 2 flags to disambiguate the arc, to the given point.

GooCanvasPathCommandType specifies the type of each command in the path. See the path element in the Scalable Vector Graphics (SVG) specification for more details.


union GooCanvasPathCommand

union _GooCanvasPathCommand
{
  /* Simple commands like moveto and lineto: MmZzLlHhVv. */
  struct {
    guint type : 5; /* GooCanvasPathCommandType */
    guint relative : 1;
    gdouble x, y;
  } simple;

  /* Bezier curve commands: CcSsQqTt. */
  struct {
    guint type : 5; /* GooCanvasPathCommandType */
    guint relative : 1;
    gdouble x, y, x1, y1, x2, y2;
  } curve;

  /* The elliptical arc commands: Aa. */
  struct {
    guint type : 5; /* GooCanvasPathCommandType */
    guint relative : 1;
    guint large_arc_flag : 1;
    guint sweep_flag : 1;
    gdouble rx, ry, x_axis_rotation, x, y;
  } arc;
};

GooCanvasPathCommand holds the data for each command in the path.

The relative flag specifies that the coordinates for the command are relative to the current point. Otherwise they are assumed to be absolute coordinates.


goo_canvas_parse_path_data ()

GArray *            goo_canvas_parse_path_data          (const gchar *path_data);

Parses the given SVG path specification string.

path_data :

the sequence of path commands, specified as a string using the same syntax as in the Scalable Vector Graphics (SVG) path element.

Returns :

a GArray of GooCanvasPathCommand elements. [element-type GooCanvasPathCommand][transfer full]

goo_canvas_create_path ()

void                goo_canvas_create_path              (GArray *commands,
                                                         cairo_t *cr);

Creates the path specified by the given GooCanvasPathCommand array.

commands :

an array of GooCanvasPathCommand.

cr :

a cairo context.

GooCairoAntialias

typedef cairo_antialias_t GooCairoAntialias;

GooCairoAntialias is simply a wrapper for the cairo_antialias_t type, allowing it to be used for GObject properties.

See the cairo_antialias_t documentation.


GooCairoFillRule

typedef cairo_fill_rule_t GooCairoFillRule;

GooCairoFillRule is simply a wrapper for the cairo_fill_rule_t type, allowing it to be used for GObject properties.

See the cairo_fill_rule_t documentation.


GooCairoHintMetrics

typedef cairo_hint_metrics_t GooCairoHintMetrics;

GooCairoHintMetrics is simply a wrapper for the cairo_hint_metrics_t type, allowing it to be used for GObject properties.

See the cairo_hint_metrics_t documentation.


GooCairoLineCap

typedef cairo_line_cap_t GooCairoLineCap;

GooCairoLineCap is simply a wrapper for the cairo_line_cap_t type, allowing it to be used for GObject properties.

See the cairo_line_cap_t documentation.


GooCairoLineJoin

typedef cairo_line_join_t GooCairoLineJoin;

GooCairoLineJoin is simply a wrapper for the cairo_line_join_t type, allowing it to be used for GObject properties.

See the cairo_line_join_t documentation.


GooCairoOperator

typedef cairo_operator_t GooCairoOperator;

GooCairoOperator is simply a wrapper for the cairo_operator_t type, allowing it to be used for GObject properties.

See the cairo_operator_t documentation.


GooCairoMatrix

typedef cairo_matrix_t		GooCairoMatrix;

GooCairoMatrix is simply a wrapper for the cairo_matrix_t type, allowing it to be used for GObject properties.

See the cairo_matrix_t documentation.


GooCairoPattern

typedef cairo_pattern_t		GooCairoPattern;

GooCairoPattern is simply a wrapper for the cairo_pattern_t type, allowing it to be used for GObject properties.

See the cairo_pattern_t documentation.