annotate src/paint.h @ 52:59a295651480

Add action mb_chgcolor_t to change color of paints.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 09 Aug 2008 22:16:23 +0800
parents 56f592f56ff7
children 01ed2bc37eed
rev   line source
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __PAINT_H_
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __PAINT_H_
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include <cairo.h>
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #include "mb_types.h"
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 #include "redraw_man.h"
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
7 #include "tools.h"
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 typedef float co_comp_t;
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 extern paint_t *paint_color_new(redraw_man_t *rdman,
21
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
12 co_comp_t r, co_comp_t g,
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
13 co_comp_t b, co_comp_t a);
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 extern void paint_color_set(paint_t *paint,
21
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
15 co_comp_t r, co_comp_t g,
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
16 co_comp_t b, co_comp_t a);
52
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 23
diff changeset
17 extern void paint_color_get(paint_t *paint,
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 23
diff changeset
18 co_comp_t *r, co_comp_t *g,
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 23
diff changeset
19 co_comp_t *b, co_comp_t *a);
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
20 #define paint_init(_paint, _prepare, _free) \
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
21 do { \
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
22 (_paint)->prepare = _prepare; \
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
23 (_paint)->free = _free; \
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
24 STAILQ_INIT((_paint)->members); \
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
25 } while(0) \
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
27
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
28 typedef struct _grad_stop {
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
29 co_aix offset;
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
30 co_comp_t r, g, b, a;
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
31 } grad_stop_t;
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
32
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
33 extern paint_t *paint_linear_new(redraw_man_t *rdman,
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
34 co_aix x1, co_aix y1, co_aix x2, co_aix y2);
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
35 extern grad_stop_t *paint_linear_stops(paint_t *paint,
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
36 int n_stops,
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
37 grad_stop_t *stops);
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
38 #define grad_stop_init(stop, _offset, _r, _g, _b, _a) \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
39 do { \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
40 (stop)->offset = _offset; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
41 (stop)->r = _r; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
42 (stop)->g = _g; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
43 (stop)->b = _b; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
44 (stop)->a = _a; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
45 } while(0)
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
46
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
47
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 #endif /* __PAINT_H_ */