Mercurial > MadButterfly
annotate include/mb_redraw_man.h @ 260:29acbd8a0dd0
Integrate sh_image with svg2code.py.
diff -r e8a784a306d0 examples/svg2code_ex/dsc_3241.png
Binary file examples/svg2code_ex/dsc_3241.png has changed
diff -r e8a784a306d0 examples/svg2code_ex/dsc_3241.png
Binary file examples/svg2code_ex/dsc_3241.png has changed
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 23 Jan 2009 23:00:23 +0800 |
parents | 50d253d0fcba |
children | b42ee279669e |
rev | line source |
---|---|
12 | 1 #ifndef __REDRAW_MAN_H_ |
2 #define __REDRAW_MAN_H_ | |
3 | |
15
c2ce186a5c37
X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents:
14
diff
changeset
|
4 #include <cairo.h> |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
185
diff
changeset
|
5 #include "mb_tools.h" |
12 | 6 #include "mb_types.h" |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
185
diff
changeset
|
7 #include "mb_observer.h" |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
8 #include "mb_img_ldr.h" |
12 | 9 |
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
|
10 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
|
11 |
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 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
|
13 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
|
14 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
|
15 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
|
16 }; |
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 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
|
18 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
|
19 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
|
20 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
|
21 }; |
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 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
|
23 |
158
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
24 DARRAY(coords, coord_t *); |
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
25 DARRAY(geos, geo_t *); |
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
26 DARRAY(areas, area_t *); |
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
27 |
13 | 28 /*! \brief Manage redrawing of shapes (graphic elements). |
29 * | |
30 * Every coord_t and geo_t object is assigned with a unique | |
31 * incremental order. The order is a unsigned integer. | |
32 * Every time a new coord_t or geo_t object is added, it is | |
33 * assigned with a order number that 1 bigger than last one | |
34 * until reaching maximum of unsigned integer. | |
35 * When a maximum is meet, all coord_t or geo_t objects | |
36 * are reasigned with a new order number from 1. It means | |
37 * order numbers that have been assigned and then removed | |
38 * later are recycled. | |
39 * | |
40 * Dirty flag is clear when the transformation matrix of a coord | |
41 * object been recomputed or when a geo_t objects been redrawed. | |
42 */ | |
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
|
43 struct _redraw_man { |
13 | 44 unsigned int next_coord_order; |
45 int n_coords; | |
12 | 46 coord_t *root_coord; |
13 | 47 |
12 | 48 elmpool_t *geo_pool; |
49 elmpool_t *coord_pool; | |
18
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
50 elmpool_t *shnode_pool; |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
37
diff
changeset
|
51 elmpool_t *observer_pool; |
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
37
diff
changeset
|
52 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
|
53 elmpool_t *paint_color_pool; |
224
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
54 elmpool_t *pent_pool; |
13 | 55 |
158
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
56 coords_t dirty_coords; |
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
57 geos_t dirty_geos; |
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
58 areas_t dirty_areas; |
13 | 59 |
158
c1cdd3fcd28f
Postponing rdman_coord_free() and rdman_remove_shape().
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
60 geos_t gen_geos; |
13 | 61 |
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
|
62 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
|
63 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
|
64 |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
158
diff
changeset
|
65 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
|
66 |
15
c2ce186a5c37
X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents:
14
diff
changeset
|
67 cairo_t *cr; |
24
e598bc809c0f
No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents:
22
diff
changeset
|
68 cairo_t *backend; |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
37
diff
changeset
|
69 |
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
37
diff
changeset
|
70 ob_factory_t ob_factory; |
154 | 71 |
72 subject_t *redraw; /*!< \brief Notified after redrawing. */ | |
224
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
73 subject_t *addrm_monitor; /*!< \brief Monitor adding/removing observers |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
74 * to/from mouse event subjects. |
231
2637519e2bd7
Move mouse event handler and interpreter to src/mouse.c.
Thinker K.F. Li <thinker@branda.to>
parents:
227
diff
changeset
|
75 * \see addrm_monitor_hdlr() |
224
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
76 */ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
77 mb_obj_t *last_mouse_over; |
249
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
78 void *rt; /*!< \brief This is a pointer to the current |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
79 * graphic backend. |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
80 * \see rdman_attach_backend() |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
81 */ |
257
50d253d0fcba
Simple image loader and image shape.
Thinker K.F. Li <thinker@branda.to>
parents:
253
diff
changeset
|
82 mb_prop_store_t props; |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
83 mb_img_ldr_t *img_ldr; /*!< \brief Image Loader. |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
84 * This is initialized by backend. |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
85 */ |
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
|
86 }; |
12 | 87 |
24
e598bc809c0f
No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents:
22
diff
changeset
|
88 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
|
89 cairo_t *backend); |
12 | 90 extern void redraw_man_destroy(redraw_man_t *rdman); |
91 extern int rdman_find_overlaid_shapes(redraw_man_t *rdman, | |
92 geo_t *geo, | |
93 geo_t ***overlays); | |
94 extern int rdman_add_shape(redraw_man_t *rdman, | |
95 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
|
96 /*! \brief Make a shape been managed by a redraw manager. */ |
224
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
97 #define rdman_shape_man(rdman, shape) \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
98 do { \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
99 mb_prop_store_init(&((mb_obj_t *)(shape))->props, \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
100 (rdman)->pent_pool); \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
101 STAILQ_INS_TAIL(rdman->shapes, shape_t, sh_next, shape); \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
102 if(rdman->last_mouse_over == (mb_obj_t *)(shape)) \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
103 rdman->last_mouse_over = NULL; \ |
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
104 } 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
|
105 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
|
106 |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
158
diff
changeset
|
107 #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
|
108 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
|
109 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
|
110 |
12 | 111 extern coord_t *rdman_coord_new(redraw_man_t *rdman, coord_t *parent); |
112 extern int rdman_coord_free(redraw_man_t *rdman, coord_t *coord); | |
154 | 113 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
|
114 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
|
115 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
|
116 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
|
117 extern int rdman_redraw_all(redraw_man_t *rdman); |
37 | 118 extern int rdman_redraw_area(redraw_man_t *rdman, co_aix x, co_aix y, |
119 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
|
120 extern geo_t *rdman_geos(redraw_man_t *rdman, geo_t *last); |
235 | 121 #define rdman_shapes(rdman, last_shape) \ |
122 geo_get_shape_safe(rdman_geos(rdman, sh_get_geo_safe(last_shape))) | |
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
|
123 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
|
124 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
|
125 #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
|
126 #define shnode_list_free(rdman, q) \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
127 do { \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
128 shnode_t *__node, *__last; \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
129 __last = STAILQ_HEAD(q); \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
130 if(__last == NULL) break; \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
131 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
|
132 __node != NULL; \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
133 __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
|
134 shnode_free(rdman, __last); \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
135 __last = __node; \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
136 } \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
137 shnode_free(rdman, __last); \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
138 } while(0) |
22 | 139 #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
|
140 do { \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
141 shnode_t *__node; \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
142 if((shape)->fill != (paint) && \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
143 (shape)->stroke != (paint)) { \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
144 __node = shnode_new(rdman, shape); \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
145 STAILQ_INS_TAIL((paint)->members, \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
146 shnode_t, next, __node); \ |
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
147 } \ |
22 | 148 } 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
|
149 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
|
150 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
|
151 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
|
152 #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
|
153 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
|
154 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
|
155 (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
|
156 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
|
157 _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
|
158 } while(0) |
22 | 159 #define rdman_paint_fill(rdman, paint, shape) \ |
160 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
|
161 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
|
162 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
|
163 _rdman_paint_remove_child(rdman, paint, shape); \ |
22 | 164 _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
|
165 (shape)->fill = paint; \ |
18
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
166 } while(0) |
22 | 167 #define rdman_paint_stroke(rdman, paint, shape) \ |
168 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
|
169 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
|
170 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
|
171 _rdman_paint_remove_child(rdman, paint, shape); \ |
22 | 172 _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
|
173 (shape)->stroke = paint; \ |
22 | 174 } while(0) |
18
0f3baa488a62
Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
16
diff
changeset
|
175 extern int rdman_paint_changed(redraw_man_t *rdman, paint_t *paint); |
12 | 176 |
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
|
177 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
|
178 co_aix x, co_aix y, int *in_stroke); |
232
527894c2ad39
Add functions for collision test.
Thinker K.F. Li <thinker@branda.to>
parents:
231
diff
changeset
|
179 extern int mb_obj_pos_is_in(redraw_man_t *rdman, mb_obj_t *obj, |
527894c2ad39
Add functions for collision test.
Thinker K.F. Li <thinker@branda.to>
parents:
231
diff
changeset
|
180 co_aix x, co_aix y, int *in_stroke); |
253
99a9cca4bbd0
Fix typo in mb_redraw_man.h
Thinker K.F. Li <thinker@branda.to>
parents:
249
diff
changeset
|
181 extern int mb_objs_are_overlay(redraw_man_t *rdman, |
99a9cca4bbd0
Fix typo in mb_redraw_man.h
Thinker K.F. Li <thinker@branda.to>
parents:
249
diff
changeset
|
182 mb_obj_t *obj1, mb_obj_t *obj2); |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
37
diff
changeset
|
183 #define rdman_get_ob_factory(rdman) (&(rdman)->ob_factory) |
154 | 184 #define rdman_get_redraw_subject(rdman) ((rdman)->redraw) |
224
29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents:
186
diff
changeset
|
185 #define rdman_get_root(rdman) ((rdman)->root_coord) |
235 | 186 #define rdman_get_cr(rdman) ((rdman)->cr) |
187 #define rdman_get_gen_geos(rdman) (&(rdman)->gen_geos) | |
188 extern int rdman_add_gen_geos(redraw_man_t *rdman, geo_t *geo); | |
189 #define rdman_get_shape_gl(rdman, idx) \ | |
190 geo_get_shape(rdman_get_gen_geos(rdman)->ds[idx]) | |
191 #define rdman_add_shape_gl(rdman, shape) \ | |
192 rdman_add_gen_geos(rdman, sh_get_geo(shape)) | |
193 #define rdman_shape_gl_len(rdman) \ | |
194 rdman_get_gen_geos(rdman)->num | |
195 #define rdman_clear_shape_gl(rdman) \ | |
196 DARRAY_CLEAN(rdman_get_gen_geos(rdman)) | |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
197 #define rdman_prop_store(rdman) ((rdman)->props) |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
198 #define rdman_img_ldr(rdman) ((rdman)->img_ldr) |
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
|
199 |
249
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
200 /*! \brief Attach backend to the redraw manager so that we can hide the backend from the users. |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
201 * |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
202 */ |
ab8284c8dcee
* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents:
235
diff
changeset
|
203 #define rdman_attach_backend(rdman,backend) (((rdman)->rt)=(backend)) |
227 | 204 /*! \brief Load sprite dymanicly from the shared object module. |
205 * | |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
206 * The search path can be changed by sprite_set_search_path. The name |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
207 * can have a relative path in the front of it. |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
208 * This function will search the object in the current working directory |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
209 * and then search the system search path. |
227 | 210 */ |
211 mb_sprite_t *sprite_load(const char *name, redraw_man_t *rdman, coord_t *root); | |
212 | |
213 /*! \brief Set the search path of dymanic object loading. | |
214 * | |
215 */ | |
216 void sprite_set_search_path(char *path); | |
12 | 217 |
218 #endif /* __REDRAW_MAN_H_ */ |