comparison include/mb_types.h @ 283:7d106e4ef66d

Fix the compilation error of the inkscape
author wycc@wycc-desktop
date Sat, 31 Jan 2009 13:01:07 +0800
parents 29acbd8a0dd0
children 2469f8d23658
comparison
equal deleted inserted replaced
282:61aebecbb994 283:7d106e4ef66d
38 enum { MBO_DUMMY, 38 enum { MBO_DUMMY,
39 MBO_COORD, 39 MBO_COORD,
40 MBO_SHAPES=0x1000, /*! \note Don't touch this. */ 40 MBO_SHAPES=0x1000, /*! \note Don't touch this. */
41 MBO_PATH, 41 MBO_PATH,
42 MBO_TEXT, 42 MBO_TEXT,
43 MBO_RECT 43 MBO_RECT,
44 MBO_IMAGE
44 }; 45 };
45 #define MBO_CLASS_MASK 0xf000 46 #define MBO_CLASS_MASK 0xf000
46 #define MBO_CLASS(x) (((mb_obj_t *)(x))->obj_type & MBO_CLASS_MASK) 47 #define MBO_CLASS(x) (((mb_obj_t *)(x))->obj_type & MBO_CLASS_MASK)
47 /*! \brief Return type of a MadBufferly object. */ 48 /*! \brief Return type of a MadBufferly object. */
48 #define MBO_TYPE(x) (((mb_obj_t *)(x))->obj_type) 49 #define MBO_TYPE(x) (((mb_obj_t *)(x))->obj_type)
61 /*! \brief Base of paint types. 62 /*! \brief Base of paint types.
62 * 63 *
63 * Paints should be freed by users by calling rdman_paint_free() of 64 * Paints should be freed by users by calling rdman_paint_free() of
64 * the paint. 65 * the paint.
65 * 66 *
67 * To define a foo paint, it should define a rdman_paint_foo_new()
68 * function. It return a paint object.
69 *
66 * \todo move member functions to a seperate structure and setup a 70 * \todo move member functions to a seperate structure and setup a
67 * singleton for each paint type. 71 * singleton for each paint type.
68 */ 72 */
69 struct _paint { 73 struct _paint {
70 int flags; 74 int flags;
106 #define GEF_FREE 0x4 110 #define GEF_FREE 0x4
107 #define GEF_OV_DRAW 0x8 /*!< To flag drawed for a overlay testing. */ 111 #define GEF_OV_DRAW 0x8 /*!< To flag drawed for a overlay testing. */
108 112
109 extern int areas_are_overlay(area_t *r1, area_t *r2); 113 extern int areas_are_overlay(area_t *r1, area_t *r2);
110 extern void area_init(area_t *area, int n_pos, co_aix pos[][2]); 114 extern void area_init(area_t *area, int n_pos, co_aix pos[][2]);
115 #define _in_range(a, s, w) ((a) >= (s) && (a) < ((s) + (w)))
116 #define area_pos_is_in(area, _x, _y) \
117 (_in_range(_x, (area)->x, (area)->w) && \
118 _in_range(_y, (area)->y, (area)->h))
111 extern void geo_init(geo_t *g); 119 extern void geo_init(geo_t *g);
112 extern void geo_from_positions(geo_t *g, int n_pos, co_aix pos[][2]); 120 extern void geo_from_positions(geo_t *g, int n_pos, co_aix pos[][2]);
113 extern void geo_mark_overlay(geo_t *g, int n_others, geo_t **others, 121 extern void geo_mark_overlay(geo_t *g, int n_others, geo_t **others,
114 int *n_overlays, geo_t **overlays); 122 int *n_overlays, geo_t **overlays);
115 #define geo_get_shape(g) ((g)->shape) 123 #define geo_get_shape(g) ((g)->shape)
116 #define geo_get_shape_safe(g) ((g)? (g)->shape: NULL) 124 #define geo_get_shape_safe(g) ((g)? (g)->shape: NULL)
117 #define geo_set_shape(g, sh) do {(g)->shape = sh;} while(0) 125 #define geo_set_shape(g, sh) do {(g)->shape = sh;} while(0)
118 #define _geo_is_in(a, s, w) ((a) >= (s) && (a) < ((s) + (w))) 126 #define geo_pos_is_in(g, _x, _y) area_pos_is_in((g)->cur_area, _x, _y)
119 #define geo_pos_is_in(g, _x, _y) \
120 (_geo_is_in(_x, (g)->cur_area->x, (g)->cur_area->w) && \
121 _geo_is_in(_y, (g)->cur_area->y, (g)->cur_area->h))
122 #define geo_get_area(g) ((g)->cur_area) 127 #define geo_get_area(g) ((g)->cur_area)
123 #define geo_get_flags(g, mask) ((g)->flags & (mask)) 128 #define geo_get_flags(g, mask) ((g)->flags & (mask))
124 #define geo_set_flags(g, mask) do {(g)->flags |= mask;} while(0) 129 #define geo_set_flags(g, mask) do {(g)->flags |= mask;} while(0)
125 #define geo_clear_flags(g, mask) do {(g)->flags &= ~(mask);} while(0) 130 #define geo_clear_flags(g, mask) do {(g)->flags &= ~(mask);} while(0)
126 131
194 do { \ 199 do { \
195 (co)->flags |= COF_HIDDEN; \ 200 (co)->flags |= COF_HIDDEN; \
196 } while(0) 201 } while(0)
197 #define coord_show(co) do { co->flags &= ~COF_HIDDEN; } while(0) 202 #define coord_show(co) do { co->flags &= ~COF_HIDDEN; } while(0)
198 #define coord_get_mouse_event(coord) ((coord)->mouse_event) 203 #define coord_get_mouse_event(coord) ((coord)->mouse_event)
204 #define coord_get_aggr_matrix(coord) ((coord)->aggr_matrix)
199 #define FOR_COORDS_POSTORDER(coord, cur) \ 205 #define FOR_COORDS_POSTORDER(coord, cur) \
200 for((cur) = postorder_coord_subtree((coord), NULL); \ 206 for((cur) = postorder_coord_subtree((coord), NULL); \
201 (cur) != NULL; \ 207 (cur) != NULL; \
202 (cur) = postorder_coord_subtree((coord), (cur))) 208 (cur) = postorder_coord_subtree((coord), (cur)))
203 #define FOR_COORDS_PREORDER(coord, cur) \ 209 #define FOR_COORDS_PREORDER(coord, cur) \
267 #define sh_get_flags(sh, mask) geo_get_flags(sh_get_geo(sh), mask) 273 #define sh_get_flags(sh, mask) geo_get_flags(sh_get_geo(sh), mask)
268 #define sh_set_flags(sh, mask) geo_set_flags(sh_get_geo(sh), mask) 274 #define sh_set_flags(sh, mask) geo_set_flags(sh_get_geo(sh), mask)
269 #define sh_clear_flags(sh, mask) geo_clear_flags(sh_get_geo(sh), mask) 275 #define sh_clear_flags(sh, mask) geo_clear_flags(sh_get_geo(sh), mask)
270 #define sh_pos_is_in(sh, x, y) geo_pos_is_in(sh_get_geo(sh), x, y) 276 #define sh_pos_is_in(sh, x, y) geo_pos_is_in(sh_get_geo(sh), x, y)
271 #define sh_get_area(sh) geo_get_area(sh_get_geo(sh)) 277 #define sh_get_area(sh) geo_get_area(sh_get_geo(sh))
278 #define sh_get_coord(sh) ((sh)->coord)
279 #define sh_get_fill(sh) ((sh)->fill)
280 #define sh_get_stroke(sh) ((sh)->stroke)
272 281
273 282
274 /*! \brief A sprite is a set of graphics that being an object in animation. 283 /*! \brief A sprite is a set of graphics that being an object in animation.
275 * 284 *
276 * A sprite include graphics comprise an object. For example, a tank, in 285 * A sprite include graphics comprise an object. For example, a tank, in