~ubuntu-branches/ubuntu/gutsy/goocanvas/gutsy

« back to all changes in this revision

Viewing changes to src/goocanvaspath.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-20 18:25:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070220182558-tjofc7wdzkzlxzor
Tags: 0.6-0ubuntu1
* New upstream version (UVF exception #86533):
  - Major rewrite to make the model optional, so people can choose to have
    either a simple canvas or a model/view canvas. The standard items can be
    used in either scenario.
  - Added support for cascading style properties (things like fill color, 
    stroke width, font etc.). Properties use a GQuark for a unique 
    identifier, and a GValue for the property value, so they are very 
    flexible.
  - Added GooCanvasTable item to layout child items.
  - Made it much easier to create new items, by subclassing 
    GooCanvasItemSimple which handles most of the work. See demo/demo-item.c 
    for a simple item.
  - Added support for different units - pixels, points, inches or 
    millimeters, and allow setting of vertical 
    and horizontal resolution (dpi).
  - Added workaround for cairo's 16-bit limit, to support large canvases.
  - Added demo/scalability-demo which creates 100,000 items over a large 
    canvas. It takes a few seconds to create all the items, but once created 
    it seems to work fast enough.
  - Improved the animation code, supporting relative or absolute values for
    the x, y, scale and rotation.
  - Added "clip-path" and "clip-fill-rule" to specify a clip path 
    for an item.
* debian/control:
  - updated GTK requirement to 2.10
* debian/control, debian/libgoocanvas0.install, debian/libgoocanvas1.install,
  debian/rules:
  - updated for soname change

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define GOO_CANVAS_PATH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GOO_TYPE_CANVAS_PATH, GooCanvasPathClass))
22
22
 
23
23
 
24
 
/**
25
 
 * GooCanvasPathCommandType
26
 
 * @GOO_CANVAS_PATH_MOVE_TO: move to the given point.
27
 
 * @GOO_CANVAS_PATH_CLOSE_PATH: close the current path, drawing a line from the
28
 
 *  current position to the start of the path.
29
 
 * @GOO_CANVAS_PATH_LINE_TO: draw a line to the given point.
30
 
 * @GOO_CANVAS_PATH_HORIZONTAL_LINE_TO: draw a horizontal line to the given
31
 
 *  x coordinate.
32
 
 * @GOO_CANVAS_PATH_VERTICAL_LINE_TO: draw a vertical line to the given y
33
 
 *  coordinate.
34
 
 * @GOO_CANVAS_PATH_CURVE_TO: draw a bezier curve using two control
35
 
 *  points to the given point.
36
 
 * @GOO_CANVAS_PATH_SMOOTH_CURVE_TO: draw a bezier curve using a reflection
37
 
 *  of the last control point of the last curve as the first control point,
38
 
 *  and one new control point, to the given point.
39
 
 * @GOO_CANVAS_PATH_QUADRATIC_CURVE_TO: draw a quadratic bezier curve using
40
 
 *  a single control point to the given point.
41
 
 * @GOO_CANVAS_PATH_SMOOTH_QUADRATIC_CURVE_TO: draw a quadratic bezier curve
42
 
 *  using a reflection of the control point from the previous curve as the
43
 
 *  control point, to the given point.
44
 
 * @GOO_CANVAS_PATH_ELLIPTICAL_ARC: draw an elliptical arc, using the given
45
 
 *  2 radii, the x axis rotation, and the 2 flags to disambiguate the arc,
46
 
 *  to the given point.
47
 
 *
48
 
 * GooCanvasPathCommandType specifies the type of each command in the path.
49
 
 * See the path element in the <ulink url="http://www.w3.org/Graphics/SVG/">
50
 
 * Scalable Vector Graphics (SVG) specification</ulink> for more details.
51
 
 */
52
 
typedef enum
53
 
{
54
 
  /* Simple commands like moveto and lineto: MmZzLlHhVv. */
55
 
  GOO_CANVAS_PATH_MOVE_TO,
56
 
  GOO_CANVAS_PATH_CLOSE_PATH,
57
 
  GOO_CANVAS_PATH_LINE_TO,
58
 
  GOO_CANVAS_PATH_HORIZONTAL_LINE_TO,
59
 
  GOO_CANVAS_PATH_VERTICAL_LINE_TO,
60
 
 
61
 
  /* Bezier curve commands: CcSsQqTt. */
62
 
  GOO_CANVAS_PATH_CURVE_TO,
63
 
  GOO_CANVAS_PATH_SMOOTH_CURVE_TO,
64
 
  GOO_CANVAS_PATH_QUADRATIC_CURVE_TO,
65
 
  GOO_CANVAS_PATH_SMOOTH_QUADRATIC_CURVE_TO,
66
 
 
67
 
  /* The elliptical arc commands: Aa. */
68
 
  GOO_CANVAS_PATH_ELLIPTICAL_ARC
69
 
} GooCanvasPathCommandType;
70
 
 
71
 
 
72
 
typedef union _GooCanvasPathCommand  GooCanvasPathCommand;
73
 
 
74
 
/* Note that the command type is always the first element in each struct, so
75
 
   we can always use it whatever type of command it is. */
76
 
 
77
 
/**
78
 
 * GooCanvasPathCommand
79
 
 *
80
 
 * GooCanvasPathCommand holds the data for each command in the path.
81
 
 *
82
 
 * The @relative flag specifies that the coordinates for the command are
83
 
 * relative to the current point. Otherwise they are assumed to be absolute
84
 
 * coordinates.
85
 
 */
86
 
union _GooCanvasPathCommand
87
 
{
88
 
  /* Simple commands like moveto and lineto: MmZzLlHhVv. */
89
 
  struct {
90
 
    guint type : 5; /* GooCanvasPathCommandType */
91
 
    guint relative : 1;
92
 
    gdouble x, y;
93
 
  } simple;
94
 
 
95
 
  /* Bezier curve commands: CcSsQqTt. */
96
 
  struct {
97
 
    guint type : 5; /* GooCanvasPathCommandType */
98
 
    guint relative : 1;
99
 
    gdouble x, y, x1, y1, x2, y2;
100
 
  } curve;
101
 
 
102
 
  /* The elliptical arc commands: Aa. */
103
 
  struct {
104
 
    guint type : 5; /* GooCanvasPathCommandType */
105
 
    guint relative : 1;
106
 
    guint large_arc_flag : 1;
107
 
    guint sweep_flag : 1;
108
 
    gdouble rx, ry, x_axis_rotation, x, y;
109
 
  } arc;
110
 
};
111
 
 
112
 
 
113
24
typedef struct _GooCanvasPath       GooCanvasPath;
114
25
typedef struct _GooCanvasPathClass  GooCanvasPathClass;
115
26
 
116
27
/**
117
28
 * GooCanvasPath
118
 
 * @commands: an array of #GooCanvasPathCommand holding the specification of
119
 
 *  the path. Applications can modify this directly, but must call
120
 
 *  goo_canvas_item_simple_emit_changed() afterwards to notify the
121
 
 *  views that the #GooCanvasPath has changed.
122
29
 *
123
 
 * The #GooCanvasPath-struct contains the list of commands specifying the path.
 
30
 * The #GooCanvasPath-struct struct contains private data only.
124
31
 */
125
32
struct _GooCanvasPath
126
33
{
127
34
  GooCanvasItemSimple parent;
128
35
 
129
 
  /*< public >*/
130
 
  GArray *commands;
 
36
  /* An array of GooCanvasPathCommand. */
 
37
  GArray *path_commands;
131
38
};
132
39
 
133
40
struct _GooCanvasPathClass
134
41
{
135
42
  GooCanvasItemSimpleClass parent_class;
136
 
};
137
 
 
138
 
 
139
 
GType           goo_canvas_path_get_type          (void) G_GNUC_CONST;
140
 
GooCanvasItem*  goo_canvas_path_new               (GooCanvasItem *parent,
141
 
                                                   gchar         *path_data,
142
 
                                                   ...);
 
43
 
 
44
  /*< private >*/
 
45
 
 
46
  /* Padding for future expansion */
 
47
  void (*_goo_canvas_reserved1) (void);
 
48
  void (*_goo_canvas_reserved2) (void);
 
49
  void (*_goo_canvas_reserved3) (void);
 
50
  void (*_goo_canvas_reserved4) (void);
 
51
};
 
52
 
 
53
 
 
54
GType               goo_canvas_path_get_type  (void) G_GNUC_CONST;
 
55
 
 
56
GooCanvasItem*      goo_canvas_path_new       (GooCanvasItem      *parent,
 
57
                                               const gchar        *path_data,
 
58
                                               ...);
 
59
 
 
60
 
 
61
 
 
62
#define GOO_TYPE_CANVAS_PATH_MODEL            (goo_canvas_path_model_get_type ())
 
63
#define GOO_CANVAS_PATH_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOO_TYPE_CANVAS_PATH_MODEL, GooCanvasPathModel))
 
64
#define GOO_CANVAS_PATH_MODEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GOO_TYPE_CANVAS_PATH_MODEL, GooCanvasPathModelClass))
 
65
#define GOO_IS_CANVAS_PATH_MODEL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOO_TYPE_CANVAS_PATH_MODEL))
 
66
#define GOO_IS_CANVAS_PATH_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GOO_TYPE_CANVAS_PATH_MODEL))
 
67
#define GOO_CANVAS_PATH_MODEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GOO_TYPE_CANVAS_PATH_MODEL, GooCanvasPathModelClass))
 
68
 
 
69
 
 
70
typedef struct _GooCanvasPathModel       GooCanvasPathModel;
 
71
typedef struct _GooCanvasPathModelClass  GooCanvasPathModelClass;
 
72
 
 
73
/**
 
74
 * GooCanvasPathModel
 
75
 *
 
76
 * The #GooCanvasPathModel-struct struct contains private data only.
 
77
 */
 
78
struct _GooCanvasPathModel
 
79
{
 
80
  GooCanvasItemModelSimple parent_object;
 
81
 
 
82
  /* An array of GooCanvasPathCommand. */
 
83
  GArray *path_commands;
 
84
};
 
85
 
 
86
struct _GooCanvasPathModelClass
 
87
{
 
88
  GooCanvasItemModelSimpleClass parent_class;
 
89
 
 
90
  /*< private >*/
 
91
 
 
92
  /* Padding for future expansion */
 
93
  void (*_goo_canvas_reserved1) (void);
 
94
  void (*_goo_canvas_reserved2) (void);
 
95
  void (*_goo_canvas_reserved3) (void);
 
96
  void (*_goo_canvas_reserved4) (void);
 
97
};
 
98
 
 
99
 
 
100
GType               goo_canvas_path_model_get_type  (void) G_GNUC_CONST;
 
101
 
 
102
GooCanvasItemModel* goo_canvas_path_model_new (GooCanvasItemModel *parent,
 
103
                                               const gchar        *path_data,
 
104
                                               ...);
143
105
 
144
106
 
145
107
G_END_DECLS