4 * An OpenGL based 'interactive canvas' library.
6 * Authored By Matthew Allum <mallum@openedhand.com>
8 * Copyright (C) 2008 Intel Corporation
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <clutter/clutter.h> can be included directly."
28 #ifndef __CLUTTER_PATH_H__
29 #define __CLUTTER_PATH_H__
32 #include <clutter/clutter-types.h>
36 #define CLUTTER_TYPE_PATH (clutter_path_get_type ())
37 #define CLUTTER_TYPE_PATH_NODE (clutter_path_node_get_type ())
38 #define CLUTTER_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PATH, ClutterPath))
39 #define CLUTTER_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PATH, ClutterPathClass))
40 #define CLUTTER_IS_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PATH))
41 #define CLUTTER_IS_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PATH))
42 #define CLUTTER_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PATH, ClutterPathClass))
44 typedef struct _ClutterPathClass ClutterPathClass;
45 typedef struct _ClutterPathPrivate ClutterPathPrivate;
46 typedef struct _ClutterPathNode ClutterPathNode;
49 * ClutterPathCallback:
51 * @data: (closure): optional data passed to the function
53 * This function is passed to clutter_path_foreach() and will be
54 * called for each node contained in the path.
58 typedef void (* ClutterPathCallback) (const ClutterPathNode *node,
64 * The #ClutterPath struct contains only private data and should
65 * be accessed with the functions below.
72 GInitiallyUnowned parent;
74 ClutterPathPrivate *priv;
80 * The #ClutterPathClass struct contains only private data.
84 struct _ClutterPathClass
87 GInitiallyUnownedClass parent_class;
92 * @type: the node's type
93 * @points: the coordinates of the node
95 * Represents a single node of a #ClutterPath.
97 * Some of the coordinates in @points may be unused for some node
98 * types. %CLUTTER_PATH_MOVE_TO and %CLUTTER_PATH_LINE_TO use only one
99 * pair of coordinates, %CLUTTER_PATH_CURVE_TO uses all three and
100 * %CLUTTER_PATH_CLOSE uses none.
104 struct _ClutterPathNode
106 ClutterPathNodeType type;
108 ClutterKnot points[3];
111 GType clutter_path_get_type (void) G_GNUC_CONST;
112 GType clutter_path_node_get_type (void) G_GNUC_CONST;
114 ClutterPath *clutter_path_new (void);
115 ClutterPath *clutter_path_new_with_description (const gchar *desc);
116 void clutter_path_add_move_to (ClutterPath *path,
119 void clutter_path_add_rel_move_to (ClutterPath *path,
122 void clutter_path_add_line_to (ClutterPath *path,
125 void clutter_path_add_rel_line_to (ClutterPath *path,
128 void clutter_path_add_curve_to (ClutterPath *path,
135 void clutter_path_add_rel_curve_to (ClutterPath *path,
142 void clutter_path_add_close (ClutterPath *path);
143 gboolean clutter_path_add_string (ClutterPath *path,
145 void clutter_path_add_node (ClutterPath *path,
146 const ClutterPathNode *node);
147 void clutter_path_add_cairo_path (ClutterPath *path,
148 const cairo_path_t *cpath);
149 guint clutter_path_get_n_nodes (ClutterPath *path);
150 void clutter_path_get_node (ClutterPath *path,
152 ClutterPathNode *node);
153 GSList * clutter_path_get_nodes (ClutterPath *path);
154 void clutter_path_foreach (ClutterPath *path,
155 ClutterPathCallback callback,
157 void clutter_path_insert_node (ClutterPath *path,
159 const ClutterPathNode *node);
160 void clutter_path_remove_node (ClutterPath *path,
162 void clutter_path_replace_node (ClutterPath *path,
164 const ClutterPathNode *node);
165 gchar * clutter_path_get_description (ClutterPath *path);
166 gboolean clutter_path_set_description (ClutterPath *path,
168 void clutter_path_clear (ClutterPath *path);
169 void clutter_path_to_cairo_path (ClutterPath *path,
171 guint clutter_path_get_position (ClutterPath *path,
173 ClutterKnot *position);
174 guint clutter_path_get_length (ClutterPath *path);
176 ClutterPathNode *clutter_path_node_copy (const ClutterPathNode *node);
177 void clutter_path_node_free (ClutterPathNode *node);
178 gboolean clutter_path_node_equal (const ClutterPathNode *node_a,
179 const ClutterPathNode *node_b);
183 #endif /* __CLUTTER_PATH_H__ */