Mercurial > MadButterfly
comparison src/X_main.c @ 35:581a03196093
Support rectangle tag of SVG.
- Change rectangle in X_main to sh_rect_t.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 06 Aug 2008 02:11:53 +0800 |
parents | d82749f77108 |
children | 943acee7f346 |
comparison
equal
deleted
inserted
replaced
34:07c523c799f4 | 35:581a03196093 |
---|---|
54 | 54 |
55 void draw_path(cairo_t *cr, int w, int h) { | 55 void draw_path(cairo_t *cr, int w, int h) { |
56 cairo_t *tmpcr; | 56 cairo_t *tmpcr; |
57 cairo_surface_t *tmpsuf; | 57 cairo_surface_t *tmpsuf; |
58 redraw_man_t rdman; | 58 redraw_man_t rdman; |
59 shape_t *path1, *path2, *path3; | 59 shape_t *path1, *path2, *rect; |
60 coord_t *coord1, *coord2, *coord3; | 60 coord_t *coord1, *coord2, *coord3; |
61 paint_t *fill1, *fill2, *fill3; | 61 paint_t *fill1, *fill2, *fill3; |
62 paint_t *stroke, *text_stroke; | 62 paint_t *stroke, *text_stroke; |
63 shape_t *text; | 63 shape_t *text; |
64 grad_stop_t fill3_stops[3]; | 64 grad_stop_t fill3_stops[3]; |
113 fill3 = paint_linear_new(&rdman, 50, 50, 150, 150); | 113 fill3 = paint_linear_new(&rdman, 50, 50, 150, 150); |
114 grad_stop_init(fill3_stops, 0, 1, 0, 0, 0.5); | 114 grad_stop_init(fill3_stops, 0, 1, 0, 0, 0.5); |
115 grad_stop_init(fill3_stops + 1, 0.5, 0, 1, 0, 0.5); | 115 grad_stop_init(fill3_stops + 1, 0.5, 0, 1, 0, 0.5); |
116 grad_stop_init(fill3_stops + 2, 1, 0, 0, 1, 0.5); | 116 grad_stop_init(fill3_stops + 2, 1, 0, 0, 1, 0.5); |
117 paint_linear_stops(fill3, 3, fill3_stops); | 117 paint_linear_stops(fill3, 3, fill3_stops); |
118 path3 = sh_path_new("M 50,50 L 50,150 L 150,150 L 150,50 z"); | 118 rect = sh_rect_new(50, 50, 100, 100, 20, 20); |
119 rdman_paint_fill(&rdman, fill3, path3); | 119 rdman_paint_fill(&rdman, fill3, rect); |
120 rdman_add_shape(&rdman, (shape_t *)path3, rdman.root_coord); | 120 rdman_add_shape(&rdman, (shape_t *)rect, rdman.root_coord); |
121 | 121 |
122 rdman_redraw_all(&rdman); | 122 rdman_redraw_all(&rdman); |
123 | 123 |
124 XFlush(display); | 124 XFlush(display); |
125 | 125 |
215 stroke->free(stroke); | 215 stroke->free(stroke); |
216 text_stroke->free(text_stroke); | 216 text_stroke->free(text_stroke); |
217 redraw_man_destroy(&rdman); | 217 redraw_man_destroy(&rdman); |
218 sh_path_free(path1); | 218 sh_path_free(path1); |
219 sh_path_free(path2); | 219 sh_path_free(path2); |
220 sh_rect_free(rect); | |
220 sh_text_free(text); | 221 sh_text_free(text); |
221 cairo_destroy(tmpcr); | 222 cairo_destroy(tmpcr); |
222 cairo_surface_destroy(tmpsuf); | 223 cairo_surface_destroy(tmpsuf); |
223 } | 224 } |
224 | 225 |