comparison src/X_main.c @ 22:8fcf2d878ecd

shapes with stroke
author Thinker K.F. Li <thinker@branda.to>
date Sat, 02 Aug 2008 16:20:15 +0800
parents 83d24300a992
children 56f592f56ff7
comparison
equal deleted inserted replaced
21:83d24300a992 22:8fcf2d878ecd
15 void draw_path(cairo_t *cr, int w, int h) { 15 void draw_path(cairo_t *cr, int w, int h) {
16 redraw_man_t rdman; 16 redraw_man_t rdman;
17 shape_t *path1, *path2; 17 shape_t *path1, *path2;
18 coord_t *coord1, *coord2; 18 coord_t *coord1, *coord2;
19 paint_t *fill1, *fill2; 19 paint_t *fill1, *fill2;
20 paint_t *stroke;
20 int i; 21 int i;
21 22
22 redraw_man_init(&rdman, cr); 23 redraw_man_init(&rdman, cr);
23 coord1 = rdman_coord_new(&rdman, rdman.root_coord); 24 coord1 = rdman_coord_new(&rdman, rdman.root_coord);
24 coord2 = rdman_coord_new(&rdman, rdman.root_coord); 25 coord2 = rdman_coord_new(&rdman, rdman.root_coord);
25 26
26 fill1 = paint_color_new(&rdman, 1, 1, 0, 0.5); 27 fill1 = paint_color_new(&rdman, 1, 1, 0, 0.5);
27 fill2 = paint_color_new(&rdman, 0, 1, 1, 0.5); 28 fill2 = paint_color_new(&rdman, 0, 1, 1, 0.5);
29 stroke = paint_color_new(&rdman, 0.4, 0.4, 0.4, 1);
28 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 "); 30 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 ");
29 rdman_paint_fill(&rdman, fill1, path1); 31 rdman_paint_fill(&rdman, fill1, path1);
32 rdman_paint_stroke(&rdman, stroke, path1);
30 coord1->matrix[0] = 0.8; 33 coord1->matrix[0] = 0.8;
31 coord1->matrix[1] = 0; 34 coord1->matrix[1] = 0;
32 coord1->matrix[2] = 20; 35 coord1->matrix[2] = 20;
33 coord1->matrix[4] = 0.8; 36 coord1->matrix[4] = 0.8;
34 coord1->matrix[5] = 20; 37 coord1->matrix[5] = 20;
35 path2 = 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 "); 38 path2 = 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 ");
36 rdman_paint_fill(&rdman, fill2, path2); 39 rdman_paint_fill(&rdman, fill2, path2);
40 rdman_paint_stroke(&rdman, stroke, path2);
37 coord2->matrix[0] = -0.8; 41 coord2->matrix[0] = -0.8;
38 coord2->matrix[1] = 0; 42 coord2->matrix[1] = 0;
39 coord2->matrix[2] = 180; 43 coord2->matrix[2] = 180;
40 coord2->matrix[4] = 0.8; 44 coord2->matrix[4] = 0.8;
41 coord2->matrix[5] = 20; 45 coord2->matrix[5] = 20;