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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
1 /*! \file
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
2 * \brief Declare interfaces of shapes.
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
3 *
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
4 * \todo Add ellipse shape.
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
5 * \todo Add circle shape.
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
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
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 5
diff changeset
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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
14 /*! \page define_shape How to Define Shapes
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
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
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
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
565b55508c8d More dox
Thinker K.F. Li <thinker@branda.to>
parents: 101
diff changeset
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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
29 * - event.c::draw_shape_path()
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
30 * - redraw_man.c::clean_shape()
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
31 * - redraw_man.c::draw_shape()
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
32 */
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
33
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
34 /*! \defgroup shapes Shapes
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
35 * @{
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
38 /*! \defgroup shape_path Shape of Path
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
39 * @{
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
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
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 5
diff changeset
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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
45 /* @} */
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
47 /*! \defgroup shape_text Shape of Text
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
48 * @{
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
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
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
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
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
57 /* @} */
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
58
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
59 /*! \defgroup shape_rect Shape of Rectangle
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
60 * @{
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
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
Thinker K.F. Li <thinker@branda.to>
parents: 35
diff changeset
68 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y,
Thinker K.F. Li <thinker@branda.to>
parents: 35
diff changeset
69 co_aix w, co_aix h, co_aix rx, co_aix ry);
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
70 /* @} */
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 95
diff changeset
71 /* @} */
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
72
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73 #endif /* __SHAPES_H_ */