annotate include/mb_paint.h @ 408:7f7855df2af0

Make unittest built by automake and autoconf. ./configure --enable-testcase to build testcase.
author Thinker K.F. Li <thinker@branda.to>
date Tue, 07 Jul 2009 22:46:19 +0800
parents 3e84458968ec
children 16116d84bc5e
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"
186
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
6 #include "mb_redraw_man.h"
408
7f7855df2af0 Make unittest built by automake and autoconf.
Thinker K.F. Li <thinker@branda.to>
parents: 356
diff changeset
7 #include "mb_img_ldr.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
8 #include "mb_tools.h"
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 typedef float co_comp_t;
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
12 extern paint_t *rdman_paint_color_new(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: 56
diff changeset
13 co_comp_t r, co_comp_t g,
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
14 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
15 extern void paint_color_set(paint_t *paint,
21
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
16 co_comp_t r, co_comp_t g,
83d24300a992 opacity (alpha) channel
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
17 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
18 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
19 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
20 co_comp_t *b, co_comp_t *a);
356
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
21 #define paint_init(_paint, _type, _prepare, _free) \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
22 do { \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
23 (_paint)->pnt_type = _type; \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
24 (_paint)->flags = 0; \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
25 (_paint)->prepare = _prepare; \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
26 (_paint)->free = _free; \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
27 STAILQ_INIT((_paint)->members); \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
28 (_paint)->pnt_next = NULL; \
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
29 } while(0)
260
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
30 #define paint_destroy(_paint)
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31
23
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 typedef struct _grad_stop {
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
34 co_aix offset;
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
35 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
36 } grad_stop_t;
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
37
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
38 extern paint_t *rdman_paint_linear_new(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: 56
diff changeset
39 co_aix x1, co_aix y1,
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
40 co_aix x2, co_aix y2);
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
41 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
42 int n_stops,
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
43 grad_stop_t *stops);
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
44 extern paint_t *rdman_paint_radial_new(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: 56
diff changeset
45 co_aix cx, co_aix cy, co_aix r);
55
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
46 extern grad_stop_t *paint_radial_stops(paint_t *paint,
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
47 int n_stops,
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
48 grad_stop_t *stops);
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
49
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
50 #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
51 do { \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
52 (stop)->offset = _offset; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
53 (stop)->r = _r; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
54 (stop)->g = _g; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
55 (stop)->b = _b; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
56 (stop)->a = _a; \
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
57 } while(0)
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
58
260
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
59 /*! \brief A paint that fill or stroke shape with an image.
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
60 */
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
61 extern paint_t *rdman_paint_image_new(redraw_man_t *rdman,
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
62 mb_img_data_t *img);
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
63 /*! \brief Set a matrix to transform image.
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
64 */
29acbd8a0dd0 Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
65 extern void paint_image_set_matrix(paint_t *paint, co_aix matrix[6]);
356
3e84458968ec Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents: 260
diff changeset
66 extern void paint_image_get_size(paint_t *paint, int *w, int *h);
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
67
18
0f3baa488a62 Support solid color paint for fill.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68 #endif /* __PAINT_H_ */