annotate include/mb/redraw_man.h @ 185:c7e5b8779bb5 include_mb_test

Move header files into include/mb/ subdirectory and remove symlink 'mb'.
author Thinker K.F. Li <thinker@branda.to>
date Tue, 04 Nov 2008 17:00:26 +0800
parents src/redraw_man.h@b90abd31a281
children
rev   line source
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __REDRAW_MAN_H_
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __REDRAW_MAN_H_
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
4 #include <cairo.h>
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #include "tools.h"
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 #include "mb_types.h"
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
7 #include "observer.h"
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
9 typedef struct _redraw_man redraw_man_t;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
10
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
11 typedef void (*free_func_t)(redraw_man_t *rdman, void *obj);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
12 struct _free_obj {
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
13 void *obj;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
14 free_func_t free_func;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
15 };
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
16 typedef struct _free_obj free_obj_t;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
17 struct _free_objs {
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
18 int num, max;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
19 free_obj_t *objs;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
20 };
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
21 typedef struct _free_objs free_objs_t;
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
22
158
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
23 DARRAY(coords, coord_t *);
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
24 DARRAY(geos, geo_t *);
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
25 DARRAY(areas, area_t *);
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
26
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
27 /*! \brief Manage redrawing of shapes (graphic elements).
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
28 *
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
29 * Every coord_t and geo_t object is assigned with a unique
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
30 * incremental order. The order is a unsigned integer.
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
31 * Every time a new coord_t or geo_t object is added, it is
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
32 * assigned with a order number that 1 bigger than last one
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
33 * until reaching maximum of unsigned integer.
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
34 * When a maximum is meet, all coord_t or geo_t objects
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
35 * are reasigned with a new order number from 1. It means
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
36 * order numbers that have been assigned and then removed
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
37 * later are recycled.
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
38 *
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
39 * Dirty flag is clear when the transformation matrix of a coord
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
40 * object been recomputed or when a geo_t objects been redrawed.
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
41 */
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
42 struct _redraw_man {
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
43 unsigned int next_coord_order;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
44 int n_coords;
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45 coord_t *root_coord;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
46
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 elmpool_t *geo_pool;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 elmpool_t *coord_pool;
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
49 elmpool_t *shnode_pool;
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
50 elmpool_t *observer_pool;
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
51 elmpool_t *subject_pool;
146
e96a584487af Use elmpool to manage paint_color_t objects.
Thinker K.F. Li <thinker@branda.to>
parents: 139
diff changeset
52 elmpool_t *paint_color_pool;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
53
158
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
54 coords_t dirty_coords;
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
55 geos_t dirty_geos;
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
56 areas_t dirty_areas;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
57
158
c1cdd3fcd28f Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents: 154
diff changeset
58 geos_t gen_geos;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
59
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
60 STAILQ(shape_t) shapes; /*!< \brief All managed shapes. */
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
61 STAILQ(paint_t) paints; /*!< \brief All managed paints. */
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
62
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
63 free_objs_t free_objs;
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 24
diff changeset
64
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
65 cairo_t *cr;
24
e598bc809c0f No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
66 cairo_t *backend;
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
67
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
68 ob_factory_t ob_factory;
154
6ce68c1f7405 Tank can fire bullet.
Thinker K.F. Li <thinker@branda.to>
parents: 146
diff changeset
69
6ce68c1f7405 Tank can fire bullet.
Thinker K.F. Li <thinker@branda.to>
parents: 146
diff changeset
70 subject_t *redraw; /*!< \brief Notified after redrawing. */
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
71 };
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
72
24
e598bc809c0f No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
73 extern int redraw_man_init(redraw_man_t *rdman, cairo_t *cr,
e598bc809c0f No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
74 cairo_t *backend);
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75 extern void redraw_man_destroy(redraw_man_t *rdman);
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 extern int rdman_find_overlaid_shapes(redraw_man_t *rdman,
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77 geo_t *geo,
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 geo_t ***overlays);
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 extern int rdman_add_shape(redraw_man_t *rdman,
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 shape_t *shape, coord_t *coord);
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
81 /*! \brief Make a shape been managed by a redraw manager. */
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
82 #define rdman_shape_man(rdman, shape) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
83 STAILQ_INS_TAIL(rdman->shapes, shape_t, sh_next, shape)
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
84 extern int rdman_shape_free(redraw_man_t *rdman, shape_t *shape);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
85
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
86 #define rdman_paint_man(rdman, paint) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
87 STAILQ_INS_TAIL(rdman->paints, paint_t, pnt_next, shape)
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
88 extern int rdman_paint_free(redraw_man_t *rdman, paint_t *paint);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
89
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 extern coord_t *rdman_coord_new(redraw_man_t *rdman, coord_t *parent);
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91 extern int rdman_coord_free(redraw_man_t *rdman, coord_t *coord);
154
6ce68c1f7405 Tank can fire bullet.
Thinker K.F. Li <thinker@branda.to>
parents: 146
diff changeset
92 extern int rdman_coord_subtree_free(redraw_man_t *rdman, coord_t *subtree);
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
93 extern int rdman_coord_changed(redraw_man_t *rdman, coord_t *coord);
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
94 extern int rdman_shape_changed(redraw_man_t *rdman, shape_t *shape);
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
95 extern int rdman_redraw_changed(redraw_man_t *rdman);
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
96 extern int rdman_redraw_all(redraw_man_t *rdman);
37
943acee7f346 update exposed area
Thinker K.F. Li <thinker@branda.to>
parents: 30
diff changeset
97 extern int rdman_redraw_area(redraw_man_t *rdman, co_aix x, co_aix y,
943acee7f346 update exposed area
Thinker K.F. Li <thinker@branda.to>
parents: 30
diff changeset
98 co_aix w, co_aix h);
139
1695a4b02b14 Members of coords are geos instead of shapes, now.
Thinker K.F. Li <thinker@branda.to>
parents: 133
diff changeset
99 extern geo_t *rdman_geos(redraw_man_t *rdman, geo_t *last);
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 24
diff changeset
100 extern int rdman_force_clean(redraw_man_t *rdman);
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
101 extern shnode_t *shnode_new(redraw_man_t *rdman, shape_t *shape);
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
102 #define shnode_free(rdman, node) elmpool_elm_free((rdman)->shnode_pool, node)
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
103 #define shnode_list_free(rdman, q) \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
104 do { \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
105 shnode_t *__node, *__last; \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
106 __last = STAILQ_HEAD(q); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
107 if(__last == NULL) break; \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
108 for(__node = STAILQ_NEXT(shnode_t, next, __last); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
109 __node != NULL; \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
110 __node = STAILQ_NEXT(shnode_t, next, __node)) { \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
111 shnode_free(rdman, __last); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
112 __last = __node; \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
113 } \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
114 shnode_free(rdman, __last); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
115 } while(0)
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
116 #define _rdman_paint_child(rdman, paint, shape) \
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
117 do { \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
118 shnode_t *__node; \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
119 if((shape)->fill != (paint) && \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
120 (shape)->stroke != (paint)) { \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
121 __node = shnode_new(rdman, shape); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
122 STAILQ_INS_TAIL((paint)->members, \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
123 shnode_t, next, __node); \
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
124 } \
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
125 } while(0)
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
126 extern void _rdman_paint_real_remove_child(redraw_man_t *rdman,
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
127 paint_t *paint,
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
128 shape_t *shape);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
129 #define _rdman_paint_remove_child(rdman, paint, shape) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
130 do { \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
131 if((shape)->fill == (shape)->stroke && \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
132 (shape)->stroke == paint) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
133 break; \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
134 _rdman_paint_real_remove_child(rdman, paint, shape); \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
135 } while(0)
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
136 #define rdman_paint_fill(rdman, paint, shape) \
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
137 do { \
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
138 if((shape)->fill == paint) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
139 break; \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
140 _rdman_paint_remove_child(rdman, paint, shape); \
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
141 _rdman_paint_child(rdman, paint, shape); \
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
142 (shape)->fill = paint; \
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
143 } while(0)
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
144 #define rdman_paint_stroke(rdman, paint, shape) \
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
145 do { \
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
146 if((shape)->stroke == paint) \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
147 break; \
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
148 _rdman_paint_remove_child(rdman, paint, shape); \
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
149 _rdman_paint_child(rdman, paint, shape); \
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 158
diff changeset
150 (shape)->stroke = paint; \
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
151 } while(0)
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents: 16
diff changeset
152 extern int rdman_paint_changed(redraw_man_t *rdman, paint_t *paint);
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
153
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 24
diff changeset
154 extern shape_t *find_shape_at_pos(redraw_man_t *rdman,
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 24
diff changeset
155 co_aix x, co_aix y, int *in_stroke);
73
9ab15ebc9061 Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
156 #define rdman_get_ob_factory(rdman) (&(rdman)->ob_factory)
154
6ce68c1f7405 Tank can fire bullet.
Thinker K.F. Li <thinker@branda.to>
parents: 146
diff changeset
157 #define rdman_get_redraw_subject(rdman) ((rdman)->redraw)
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 24
diff changeset
158
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
159
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
160 #endif /* __REDRAW_MAN_H_ */