Mercurial > MadButterfly
diff src/X_main.c @ 55:01ed2bc37eed
Radial gradient paint
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 10 Aug 2008 16:44:21 +0800 |
parents | 1b6dbafdf906 |
children | e444a8c01735 |
line wrap: on
line diff
--- a/src/X_main.c Sun Aug 10 00:29:11 2008 +0800 +++ b/src/X_main.c Sun Aug 10 16:44:21 2008 +0800 @@ -127,6 +127,8 @@ shape_t *path1, *path2, *rect; coord_t *coord1, *coord2, *coord3; paint_t *fill1, *fill2, *fill3; + paint_t *text_fill; + grad_stop_t text_stops[2]; paint_t *stroke, *text_stroke; shape_t *text; grad_stop_t fill3_stops[3]; @@ -155,9 +157,12 @@ face = cairo_get_font_face(tmpcr); text = sh_text_new("hello \xe6\xbc\xa2\xe5\xad\x97", 10, h / 4, 36.0, face); + grad_stop_init(text_stops, 0, 0.2, 0.9, 0.2, 1); + grad_stop_init(text_stops + 1, 1, 0.9, 0.2, 0.2, 0.1); + text_fill = paint_radial_new(&rdman, 100, h / 4, 70, 2, text_stops); rdman_paint_stroke(&rdman, text_stroke, text); text->stroke_width = 0.5; - rdman_paint_fill(&rdman, fill1, text); + rdman_paint_fill(&rdman, text_fill, text); rdman_add_shape(&rdman, text, coord3); path1 = sh_path_new("M 22,89.36218 C -34,-0.63782 39,-9.637817 82,12.36218 C 125,34.36218 142,136.36218 142,136.36218 C 100.66667,125.36218 74.26756,123.42795 22,89.36218 z "); @@ -237,6 +242,7 @@ fill2->free(fill2); stroke->free(stroke); text_stroke->free(text_stroke); + text_fill->free(text_fill); redraw_man_destroy(&rdman); sh_path_free(path1); sh_path_free(path2);