comparison include/mb_shapes.h @ 393:27774b93521e

Add sh_stext_t to implement a simple version of text shape. - It is still under construction. - It is supposed to be a simple, less dependency implementation. - It is more less functional than sh_text_t.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 08 Jun 2009 07:04:20 +0800
parents 3e84458968ec
children 5791263ebe7b
comparison
equal deleted inserted replaced
392:ebf83a50e1e1 393:27774b93521e
16 /*! \page define_shape How to Define Shapes 16 /*! \page define_shape How to Define Shapes
17 * 17 *
18 * A shape implementation must include 18 * A shape implementation must include
19 * - rdman_shape_*_new() 19 * - rdman_shape_*_new()
20 * - clear memory for shape_t member. 20 * - clear memory for shape_t member.
21 * - mb_obj_init() to initialize shape_t::obj.
21 * - assign *_free() to \ref shape_t::free. 22 * - assign *_free() to \ref shape_t::free.
22 * - make new object been managed by a redraw manager. 23 * - make new object been managed by a redraw manager.
23 * - call rdman_shape_man() 24 * - call rdman_shape_man()
24 * - *_free() 25 * - *_free()
25 * - assigned to \ref shape_t::free. 26 * - assigned to \ref shape_t::free.
240 extern void sh_image_transform(shape_t *shape); 241 extern void sh_image_transform(shape_t *shape);
241 extern void sh_image_draw(shape_t *shape, cairo_t *cr); 242 extern void sh_image_draw(shape_t *shape, cairo_t *cr);
242 extern void sh_image_set_geometry(shape_t *shape, co_aix x, co_aix y, 243 extern void sh_image_set_geometry(shape_t *shape, co_aix x, co_aix y,
243 co_aix w, co_aix h); 244 co_aix w, co_aix h);
244 /* @} */ 245 /* @} */
246
247 /*! \defgroup shape_stext A Simple Implementation of Shape of Image
248 * @{
249 */
250
251 /*! \defgroup font_face Define font face used to describe style of text.
252 * @{
253 */
254 /*! \brief Font face of MadButterfly.
255 *
256 * It actully a cairo_font_face_t, now. But, it can be change for latter.
257 * So, programmer should not depend on cairo_font_face_t.
258 */
259 typedef struct _mb_font_face mb_font_face_t;
260
261 enum MB_FONT_SLANTS {
262 MB_FONT_SLANT_DUMMY,
263 MB_FONT_SLANT_ROMAN,
264 MB_FONT_SLANT_ITALIC,
265 MB_FONT_SLANT_OBLIQUE,
266 MB_FONT_SLANT_MAX
267 };
268
269 extern mb_font_face_t *mb_font_face_query(redraw_man_t *rdman,
270 const char *family,
271 int slant,
272 int weight);
273 extern void mb_font_face_free(mb_font_face_t *face);
274 /* @} */
275
276 /*! \brief Describe style of a block of text.
277 *
278 * \ref sh_stext_t describes style of a text by a list of
279 * \ref mb_style_blk_t.
280 */
281 typedef struct {
282 int n_chars;
283 mb_font_face_t *face;
284 co_aix font_sz;
285 } mb_style_blk_t;
286
287 extern shape_t *rdman_shape_stext_new(redraw_man_t *rdman,
288 co_aix x, co_aix y,
289 const char *txt);
290 extern void sh_stext_transform(shape_t *shape);
291 extern void sh_stext_draw(shape_t *shape, cairo_t *cr);
292 extern int sh_stext_set_text(shape_t *shape, const char *txt);
293 extern int sh_stext_set_style(shape_t *shape,
294 const mb_style_blk_t *blks,
295 int nblks);
296
297 /* @} */
245 /* @} */ 298 /* @} */
246 299
247 #endif /* __SHAPES_H_ */ 300 #endif /* __SHAPES_H_ */