Mercurial > MadButterfly
comparison include/mb_shapes.h @ 448:16116d84bc5e
Replace Cairo with a abstract layer mb_graph_engine.
mb_graph_engine is a layer to separate MadButterfly from Cairo.
It is only a set of macro mapping to cairo implementation, now.
But, it provides a oppotunities to replace cairo with other engines;
likes skia.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 04 Aug 2009 23:35:41 +0800 |
parents | 12b117b19c2a |
children | bb4f651090bf |
comparison
equal
deleted
inserted
replaced
447:38aae921243f | 448:16116d84bc5e |
---|---|
5 * \todo Add circle shape. | 5 * \todo Add circle shape. |
6 */ | 6 */ |
7 #ifndef __SHAPES_H_ | 7 #ifndef __SHAPES_H_ |
8 #define __SHAPES_H_ | 8 #define __SHAPES_H_ |
9 | 9 |
10 #include <cairo.h> | 10 #include "mb_graph_engine.h" |
11 #include "mb_types.h" | 11 #include "mb_types.h" |
12 #include "mb_redraw_man.h" | 12 #include "mb_redraw_man.h" |
13 #include "mb_img_ldr.h" | 13 #include "mb_img_ldr.h" |
14 #include <pango/pangocairo.h> | 14 #include <pango/pangocairo.h> |
15 | 15 |
61 * @{ | 61 * @{ |
62 */ | 62 */ |
63 extern shape_t *rdman_shape_path_new(redraw_man_t *rdman, char *data); | 63 extern shape_t *rdman_shape_path_new(redraw_man_t *rdman, char *data); |
64 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); | 64 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); |
65 extern void sh_path_transform(shape_t *shape); | 65 extern void sh_path_transform(shape_t *shape); |
66 extern void sh_path_draw(shape_t *shape, cairo_t *cr); | 66 extern void sh_path_draw(shape_t *shape, mbe_t *cr); |
67 /* @} */ | 67 /* @} */ |
68 | 68 |
69 /*! \defgroup shape_text Shape of Text | 69 /*! \defgroup shape_text Shape of Text |
70 * @{ | 70 * @{ |
71 */ | 71 */ |
72 extern shape_t *rdman_shape_text_new(redraw_man_t *rdman, | 72 extern shape_t *rdman_shape_text_new(redraw_man_t *rdman, |
73 const char *txt, co_aix x, co_aix y, | 73 const char *txt, co_aix x, co_aix y, |
74 co_aix font_size, | 74 co_aix font_size, |
75 cairo_font_face_t *face,PangoAttrList *attrs); | 75 mbe_font_face_t *face,PangoAttrList *attrs); |
76 /*! \brief Change the content of the text element. | 76 /*! \brief Change the content of the text element. |
77 * In the SVG, the content of a text tag can be composed of several tspan inside it. The Madbutterfly parser will collect all content of a | 77 * In the SVG, the content of a text tag can be composed of several tspan inside it. The Madbutterfly parser will collect all content of a |
78 * text segement as a single string. The attribute of these characters are saved in a seperate data structure. In the program level, we will | 78 * text segement as a single string. The attribute of these characters are saved in a seperate data structure. In the program level, we will |
79 * not keep the SVG text tree. Instead, all attributes will be expanded into a list. | 79 * not keep the SVG text tree. Instead, all attributes will be expanded into a list. |
80 * | 80 * |
83 * | 83 * |
84 */ | 84 */ |
85 extern void sh_text_set_text(shape_t *shape, const char *txt); | 85 extern void sh_text_set_text(shape_t *shape, const char *txt); |
86 | 86 |
87 extern void sh_text_transform(shape_t *shape); | 87 extern void sh_text_transform(shape_t *shape); |
88 extern void sh_text_draw(shape_t *shape, cairo_t *cr); | 88 extern void sh_text_draw(shape_t *shape, mbe_t *cr); |
89 /* @} */ | 89 /* @} */ |
90 | 90 |
91 /*! \defgroup mb_text_t Shape of Text | 91 /*! \defgroup mb_text_t Shape of Text |
92 * @{ | 92 * @{ |
93 */ | 93 */ |
123 | 123 |
124 typedef struct { | 124 typedef struct { |
125 int nseg; | 125 int nseg; |
126 mb_text_segment_t *segs; | 126 mb_text_segment_t *segs; |
127 int flag; | 127 int flag; |
128 cairo_surface_t *surface; | 128 mbe_surface_t *surface; |
129 } mb_text_t; | 129 } mb_text_t; |
130 | 130 |
131 /*! \brief Change the style of the text. | 131 /*! \brief Change the style of the text. |
132 * | 132 * |
133 * This function can add a couple of attributes to a segment of text or the whole text field. If the @end is -1, the attributes | 133 * This function can add a couple of attributes to a segment of text or the whole text field. If the @end is -1, the attributes |
234 extern shape_t *rdman_shape_rect_new(redraw_man_t *rdman, | 234 extern shape_t *rdman_shape_rect_new(redraw_man_t *rdman, |
235 co_aix x, co_aix y, | 235 co_aix x, co_aix y, |
236 co_aix w, co_aix h, | 236 co_aix w, co_aix h, |
237 co_aix rx, co_aix ry); | 237 co_aix rx, co_aix ry); |
238 extern void sh_rect_transform(shape_t *shape); | 238 extern void sh_rect_transform(shape_t *shape); |
239 extern void sh_rect_draw(shape_t *shape, cairo_t *cr); | 239 extern void sh_rect_draw(shape_t *shape, mbe_t *cr); |
240 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y, | 240 extern void sh_rect_set(shape_t *shape, co_aix x, co_aix y, |
241 co_aix w, co_aix h, co_aix rx, co_aix ry); | 241 co_aix w, co_aix h, co_aix rx, co_aix ry); |
242 /* @} */ | 242 /* @} */ |
243 | 243 |
244 /*! \defgroup shape_image Shape of Image | 244 /*! \defgroup shape_image Shape of Image |
246 */ | 246 */ |
247 extern shape_t *rdman_shape_image_new(redraw_man_t *rdman, | 247 extern shape_t *rdman_shape_image_new(redraw_man_t *rdman, |
248 co_aix x, co_aix y, | 248 co_aix x, co_aix y, |
249 co_aix w, co_aix h); | 249 co_aix w, co_aix h); |
250 extern void sh_image_transform(shape_t *shape); | 250 extern void sh_image_transform(shape_t *shape); |
251 extern void sh_image_draw(shape_t *shape, cairo_t *cr); | 251 extern void sh_image_draw(shape_t *shape, mbe_t *cr); |
252 extern void sh_image_set_geometry(shape_t *shape, co_aix x, co_aix y, | 252 extern void sh_image_set_geometry(shape_t *shape, co_aix x, co_aix y, |
253 co_aix w, co_aix h); | 253 co_aix w, co_aix h); |
254 /* @} */ | 254 /* @} */ |
255 | 255 |
256 /*! \defgroup shape_stext Shape of Simple Text | 256 /*! \defgroup shape_stext Shape of Simple Text |
260 /*! \defgroup font_face Define font face used to describe style of text. | 260 /*! \defgroup font_face Define font face used to describe style of text. |
261 * @{ | 261 * @{ |
262 */ | 262 */ |
263 /*! \brief Font face of MadButterfly. | 263 /*! \brief Font face of MadButterfly. |
264 * | 264 * |
265 * It actully a cairo_font_face_t, now. But, it can be change for latter. | 265 * It actully a mbe_font_face_t, now. But, it can be change for latter. |
266 * So, programmer should not depend on cairo_font_face_t. | 266 * So, programmer should not depend on mbe_font_face_t. |
267 */ | 267 */ |
268 typedef struct _mb_font_face mb_font_face_t; | 268 typedef struct _mb_font_face mb_font_face_t; |
269 | 269 |
270 enum MB_FONT_SLANTS { | 270 enum MB_FONT_SLANTS { |
271 MB_FONT_SLANT_DUMMY, | 271 MB_FONT_SLANT_DUMMY, |
295 | 295 |
296 extern shape_t *rdman_shape_stext_new(redraw_man_t *rdman, | 296 extern shape_t *rdman_shape_stext_new(redraw_man_t *rdman, |
297 const char *txt, | 297 const char *txt, |
298 co_aix x, co_aix y); | 298 co_aix x, co_aix y); |
299 extern void sh_stext_transform(shape_t *shape); | 299 extern void sh_stext_transform(shape_t *shape); |
300 extern void sh_stext_draw(shape_t *shape, cairo_t *cr); | 300 extern void sh_stext_draw(shape_t *shape, mbe_t *cr); |
301 extern int sh_stext_set_text(shape_t *shape, const char *txt); | 301 extern int sh_stext_set_text(shape_t *shape, const char *txt); |
302 extern int sh_stext_set_style(shape_t *shape, | 302 extern int sh_stext_set_style(shape_t *shape, |
303 const mb_style_blk_t *blks, | 303 const mb_style_blk_t *blks, |
304 int nblks); | 304 int nblks); |
305 | 305 |