comparison src/paint.h @ 159:b90abd31a281

Postponse free of coords, shapes, and paints when the rdman is dirty. - Life-cycle of shapes and paints are managed by rdman. - Add redraw_man_t::free_objs to collect objects their freeing are postonsed. Know Issue: - Bullet of tank are not removed from screen when it is go out the range of the map.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 05 Oct 2008 23:32:58 +0800
parents e444a8c01735
children
comparison
equal deleted inserted replaced
158:c1cdd3fcd28f 159:b90abd31a281
6 #include "redraw_man.h" 6 #include "redraw_man.h"
7 #include "tools.h" 7 #include "tools.h"
8 8
9 typedef float co_comp_t; 9 typedef float co_comp_t;
10 10
11 extern paint_t *paint_color_new(redraw_man_t *rdman, 11 extern paint_t *rdman_paint_color_new(redraw_man_t *rdman,
12 co_comp_t r, co_comp_t g, 12 co_comp_t r, co_comp_t g,
13 co_comp_t b, co_comp_t a); 13 co_comp_t b, co_comp_t a);
14 extern void paint_color_set(paint_t *paint, 14 extern void paint_color_set(paint_t *paint,
15 co_comp_t r, co_comp_t g, 15 co_comp_t r, co_comp_t g,
16 co_comp_t b, co_comp_t a); 16 co_comp_t b, co_comp_t a);
17 extern void paint_color_get(paint_t *paint, 17 extern void paint_color_get(paint_t *paint,
18 co_comp_t *r, co_comp_t *g, 18 co_comp_t *r, co_comp_t *g,
19 co_comp_t *b, co_comp_t *a); 19 co_comp_t *b, co_comp_t *a);
20 #define paint_init(_paint, _prepare, _free) \ 20 #define paint_init(_paint, _prepare, _free) \
21 do { \ 21 do { \
22 (_paint)->flags = 0; \
22 (_paint)->prepare = _prepare; \ 23 (_paint)->prepare = _prepare; \
23 (_paint)->free = _free; \ 24 (_paint)->free = _free; \
24 STAILQ_INIT((_paint)->members); \ 25 STAILQ_INIT((_paint)->members); \
26 (_paint)->pnt_next = NULL; \
25 } while(0) \ 27 } while(0) \
26 28
27 29
28 typedef struct _grad_stop { 30 typedef struct _grad_stop {
29 co_aix offset; 31 co_aix offset;
30 co_comp_t r, g, b, a; 32 co_comp_t r, g, b, a;
31 } grad_stop_t; 33 } grad_stop_t;
32 34
33 extern paint_t *paint_linear_new(redraw_man_t *rdman, 35 extern paint_t *rdman_paint_linear_new(redraw_man_t *rdman,
34 co_aix x1, co_aix y1, co_aix x2, co_aix y2); 36 co_aix x1, co_aix y1,
37 co_aix x2, co_aix y2);
35 extern grad_stop_t *paint_linear_stops(paint_t *paint, 38 extern grad_stop_t *paint_linear_stops(paint_t *paint,
36 int n_stops, 39 int n_stops,
37 grad_stop_t *stops); 40 grad_stop_t *stops);
38 extern paint_t *paint_radial_new(redraw_man_t *rdman, 41 extern paint_t *rdman_paint_radial_new(redraw_man_t *rdman,
39 co_aix cx, co_aix cy, co_aix r); 42 co_aix cx, co_aix cy, co_aix r);
40 extern grad_stop_t *paint_radial_stops(paint_t *paint, 43 extern grad_stop_t *paint_radial_stops(paint_t *paint,
41 int n_stops, 44 int n_stops,
42 grad_stop_t *stops); 45 grad_stop_t *stops);
43 46
44 #define grad_stop_init(stop, _offset, _r, _g, _b, _a) \ 47 #define grad_stop_init(stop, _offset, _r, _g, _b, _a) \