comparison src/shapes.h @ 27:19c603dd6ff9

Add text shape.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 04 Aug 2008 10:10:47 +0800
parents 8fcf2d878ecd
children e06a4a667ce2
comparison
equal deleted inserted replaced
26:d50f33040de6 27:19c603dd6ff9
1 #ifndef __SHAPES_H_ 1 #ifndef __SHAPES_H_
2 #define __SHAPES_H_ 2 #define __SHAPES_H_
3 3
4 #include <cairo.h> 4 #include <cairo.h>
5 #include "mb_types.h" 5 #include "mb_types.h"
6
7 /* Define a shape
8 *
9 * A shape must include
10 * - *_new() and *_free()
11 * - *_transform()
12 * - *_fill()
13 * - *_stroke()
14 * - struct of shape must include an shape_t as type of first member.
15 */
6 16
7 extern void sh_path_free(shape_t *path); 17 extern void sh_path_free(shape_t *path);
8 extern shape_t *sh_path_new(char *data); 18 extern shape_t *sh_path_new(char *data);
9 extern void sh_path_transform(shape_t *shape); 19 extern void sh_path_transform(shape_t *shape);
10 extern void sh_path_fill(shape_t *shape, cairo_t *cr); 20 extern void sh_path_fill(shape_t *shape, cairo_t *cr);
11 extern void sh_path_stroke(shape_t *shape, cairo_t *cr); 21 extern void sh_path_stroke(shape_t *shape, cairo_t *cr);
12 22
23
24 extern void sh_text_free(shape_t *text);
25 extern shape_t *sh_text_new(const char *txt, co_aix x, co_aix y,
26 co_aix font_size, cairo_font_face_t *face);
27 extern void sh_text_transform(shape_t *shape);
28 extern void sh_text_fill(shape_t *shape, cairo_t *cr);
29 extern void sh_text_stroke(shape_t *shape, cairo_t *cr);
30
31
13 #endif /* __SHAPES_H_ */ 32 #endif /* __SHAPES_H_ */