Mercurial > MadButterfly
annotate include/mb_shapes.h @ 234:889cdc5f23c5
When a scene is selected to0 edit, we copy all of its elements out of the scene so that inkscape can edit it directly. All elements add or delete by the inkspcae will be put back when we switch the scene. The svg2code.py must recognize this structure.
author | wycc |
---|---|
date | Wed, 24 Dec 2008 23:43:39 +0800 |
parents | bcad1ccdf45c |
children | 50d253d0fcba a90fd749af82 |
rev | line source |
---|---|
101 | 1 /*! \file |
2 * \brief Declare interfaces of shapes. | |
3 * | |
4 * \todo Add ellipse shape. | |
5 * \todo Add circle shape. | |
6 */ | |
5
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 #ifndef __SHAPES_H_ |
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 #define __SHAPES_H_ |
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 |
12 | 10 #include <cairo.h> |
5
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 #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
|
12 #include "mb_redraw_man.h" |
5
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 |
101 | 14 /*! \page define_shape How to Define Shapes |
27 | 15 * |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
16 * A shape implementation must include |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
17 * - rdman_shape_*_new() |
35
581a03196093
Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents:
33
diff
changeset
|
18 * - clear memory for shape_t member. |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
19 * - assign *_free() to \ref shape_t::free. |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
20 * - make new object 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:
108
diff
changeset
|
21 * - call rdman_shape_man() |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
22 * - *_free() |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
23 * - assigned to \ref shape_t::free. |
27 | 24 * - *_transform() |
30
e06a4a667ce2
Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents:
27
diff
changeset
|
25 * - *_draw() |
108 | 26 * - first member variable of a shape type must be a shape_t. |
35
581a03196093
Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents:
33
diff
changeset
|
27 * |
581a03196093
Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents:
33
diff
changeset
|
28 * Must modify |
101 | 29 * - event.c::draw_shape_path() |
30 * - redraw_man.c::clean_shape() | |
31 * - redraw_man.c::draw_shape() | |
27 | 32 */ |
33 | |
101 | 34 /*! \defgroup shapes Shapes |
35 * @{ | |
36 */ | |
30
e06a4a667ce2
Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents:
27
diff
changeset
|
37 |
101 | 38 /*! \defgroup shape_path Shape of Path |
39 * @{ | |
40 */ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
41 extern shape_t *rdman_shape_path_new(redraw_man_t *rdman, char *data); |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
42 extern shape_t *rdman_shape_path_new_from_binary(redraw_man_t *rdman, char *commands, co_aix *arg,int arg_cnt,int *fix_arg,int fix_arg_cnt); |
12 | 43 extern void sh_path_transform(shape_t *shape); |
30
e06a4a667ce2
Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents:
27
diff
changeset
|
44 extern void sh_path_draw(shape_t *shape, cairo_t *cr); |
101 | 45 /* @} */ |
5
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 |
101 | 47 /*! \defgroup shape_text Shape of Text |
48 * @{ | |
49 */ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
50 extern shape_t *rdman_shape_text_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:
108
diff
changeset
|
51 const char *txt, co_aix x, co_aix y, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
52 co_aix font_size, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
53 cairo_font_face_t *face); |
88
dd813dcc232c
New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
73
diff
changeset
|
54 extern void sh_text_set_text(shape_t *shape, const char *txt); |
27 | 55 extern void sh_text_transform(shape_t *shape); |
30
e06a4a667ce2
Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents:
27
diff
changeset
|
56 extern void sh_text_draw(shape_t *shape, cairo_t *cr); |
101 | 57 /* @} */ |
27 | 58 |
101 | 59 /*! \defgroup shape_rect Shape of Rectangle |
60 * @{ | |
61 */ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
62 extern shape_t *rdman_shape_rect_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:
108
diff
changeset
|
63 co_aix x, co_aix y, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
64 co_aix w, co_aix h, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
108
diff
changeset
|
65 co_aix rx, co_aix ry); |
35
581a03196093
Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents:
33
diff
changeset
|
66 extern void sh_rect_transform(shape_t *shape); |
581a03196093
Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents:
33
diff
changeset
|
67 extern void sh_rect_draw(shape_t *shape, cairo_t *cr); |
40 | 68 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y, |
69 co_aix w, co_aix h, co_aix rx, co_aix ry); | |
101 | 70 /* @} */ |
71 /* @} */ | |
27 | 72 |
5
9c331ec9e210
SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 #endif /* __SHAPES_H_ */ |