comparison src/shapes.h @ 101:d6f9af55b0d0

More documentation. 1. main page 2. copyright
author Thinker K.F. Li <thinker@branda.to>
date Wed, 10 Sep 2008 13:35:56 +0800
parents 7dfa4e60b26d
children 565b55508c8d
comparison
equal deleted inserted replaced
100:1a1dda98730c 101:d6f9af55b0d0
1 /*! \file
2 * \brief Declare interfaces of shapes.
3 *
4 * \todo Add ellipse shape.
5 * \todo Add circle shape.
6 */
1 #ifndef __SHAPES_H_ 7 #ifndef __SHAPES_H_
2 #define __SHAPES_H_ 8 #define __SHAPES_H_
3 9
4 #include <cairo.h> 10 #include <cairo.h>
5 #include "mb_types.h" 11 #include "mb_types.h"
6 12
7 /* Define a shape 13 /*! \page define_shape How to Define Shapes
8 * 14 *
9 * A shape must include 15 * A shape must include
10 * - *_new() and *_free() 16 * - *_new() and *_free()
11 * - clear memory for shape_t member. 17 * - clear memory for shape_t member.
12 * - *_transform() 18 * - *_transform()
13 * - *_draw() 19 * - *_draw()
14 * - struct of shape must include an shape_t as type of first member. 20 * - struct of shape must include an shape_t as type of first member.
15 * 21 *
16 * Must modify 22 * Must modify
17 * - event.c:draw_shape_path 23 * - event.c::draw_shape_path()
18 * - redraw_man.c:clean_shape 24 * - redraw_man.c::clean_shape()
19 * - redraw_man.c:draw_shape 25 * - redraw_man.c::draw_shape()
20 *
21 * \todo Add arc for path shape.
22 * \todo Add ellipse shape.
23 * \todo Add circle shape.
24 */ 26 */
25 27
28 /*! \defgroup shapes Shapes
29 * @{
30 */
26 31
32 /*! \defgroup shape_path Shape of Path
33 * @{
34 */
27 extern shape_t *sh_path_new(char *data); 35 extern shape_t *sh_path_new(char *data);
28 extern void sh_path_transform(shape_t *shape); 36 extern void sh_path_transform(shape_t *shape);
29 extern void sh_path_draw(shape_t *shape, cairo_t *cr); 37 extern void sh_path_draw(shape_t *shape, cairo_t *cr);
38 /* @} */
30 39
31 40 /*! \defgroup shape_text Shape of Text
41 * @{
42 */
32 extern shape_t *sh_text_new(const char *txt, co_aix x, co_aix y, 43 extern shape_t *sh_text_new(const char *txt, co_aix x, co_aix y,
33 co_aix font_size, cairo_font_face_t *face); 44 co_aix font_size, cairo_font_face_t *face);
34 extern void sh_text_set_text(shape_t *shape, const char *txt); 45 extern void sh_text_set_text(shape_t *shape, const char *txt);
35 extern void sh_text_transform(shape_t *shape); 46 extern void sh_text_transform(shape_t *shape);
36 extern void sh_text_draw(shape_t *shape, cairo_t *cr); 47 extern void sh_text_draw(shape_t *shape, cairo_t *cr);
48 /* @} */
37 49
50 /*! \defgroup shape_rect Shape of Rectangle
51 * @{
52 */
38 extern shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h, 53 extern shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h,
39 co_aix rx, co_aix ry); 54 co_aix rx, co_aix ry);
40 extern void sh_rect_transform(shape_t *shape); 55 extern void sh_rect_transform(shape_t *shape);
41 extern void sh_rect_draw(shape_t *shape, cairo_t *cr); 56 extern void sh_rect_draw(shape_t *shape, cairo_t *cr);
42 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y, 57 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y,
43 co_aix w, co_aix h, co_aix rx, co_aix ry); 58 co_aix w, co_aix h, co_aix rx, co_aix ry);
59 /* @} */
60 /* @} */
44 61
45 #endif /* __SHAPES_H_ */ 62 #endif /* __SHAPES_H_ */