comparison src/X_main.c @ 21:83d24300a992

opacity (alpha) channel
author Thinker K.F. Li <thinker@branda.to>
date Sat, 02 Aug 2008 16:06:53 +0800
parents 74d3d5dc9aaa
children 8fcf2d878ecd
comparison
equal deleted inserted replaced
20:74d3d5dc9aaa 21:83d24300a992
21 21
22 redraw_man_init(&rdman, cr); 22 redraw_man_init(&rdman, cr);
23 coord1 = rdman_coord_new(&rdman, rdman.root_coord); 23 coord1 = rdman_coord_new(&rdman, rdman.root_coord);
24 coord2 = rdman_coord_new(&rdman, rdman.root_coord); 24 coord2 = rdman_coord_new(&rdman, rdman.root_coord);
25 25
26 fill1 = paint_color_new(&rdman, 1, 1, 0); 26 fill1 = paint_color_new(&rdman, 1, 1, 0, 0.5);
27 fill2 = paint_color_new(&rdman, 0, 1, 1); 27 fill2 = paint_color_new(&rdman, 0, 1, 1, 0.5);
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 "); 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 ");
29 rdman_paint_fill(&rdman, fill1, path1); 29 rdman_paint_fill(&rdman, fill1, path1);
30 coord1->matrix[0] = 0.8; 30 coord1->matrix[0] = 0.8;
31 coord1->matrix[1] = 0; 31 coord1->matrix[1] = 0;
32 coord1->matrix[2] = 20; 32 coord1->matrix[2] = 20;
52 usleep(20000); 52 usleep(20000);
53 coord1->matrix[2] += 1; 53 coord1->matrix[2] += 1;
54 coord1->matrix[5] += 1; 54 coord1->matrix[5] += 1;
55 coord2->matrix[2] -= 1; 55 coord2->matrix[2] -= 1;
56 coord2->matrix[5] += 1; 56 coord2->matrix[5] += 1;
57 paint_color_set(fill1, 1, 1, (i/25) & 0x1); 57 paint_color_set(fill1, 1, 1, (i/25) & 0x1, 0.5);
58 paint_color_set(fill2, (i/25) & 0x1, 1, 1); 58 paint_color_set(fill2, (i/25) & 0x1, 1, 1, 0.5);
59 rdman_paint_changed(&rdman, fill1); 59 rdman_paint_changed(&rdman, fill1);
60 rdman_paint_changed(&rdman, fill2); 60 rdman_paint_changed(&rdman, fill2);
61 rdman_coord_changed(&rdman, coord1); 61 rdman_coord_changed(&rdman, coord1);
62 rdman_coord_changed(&rdman, coord2); 62 rdman_coord_changed(&rdman, coord2);
63 rdman_redraw_changed(&rdman); 63 rdman_redraw_changed(&rdman);
64 XFlush(display); 64 XFlush(display);
65 } 65 }
66 66
67 for(i = 0; i < 5; i++) { 67 for(i = 0; i < 5; i++) {
68 usleep(500000); 68 usleep(500000);
69 paint_color_set(fill1, 1, i % 2, 0); 69 paint_color_set(fill1, 1, i % 2, 0, 0.5);
70 paint_color_set(fill2, 0, i % 2, 1); 70 paint_color_set(fill2, 0, i % 2, 1, 0.5);
71 rdman_paint_changed(&rdman, fill1); 71 rdman_paint_changed(&rdman, fill1);
72 rdman_paint_changed(&rdman, fill2); 72 rdman_paint_changed(&rdman, fill2);
73 rdman_redraw_changed(&rdman); 73 rdman_redraw_changed(&rdman);
74 XFlush(display); 74 XFlush(display);
75 } 75 }