diff src/X_main.c @ 23:56f592f56ff7

Fix bug and add linear gradient paint. - fix the bug that forget to clear n_dirty_geos in rdman_redraw_all().
author Thinker K.F. Li <thinker@branda.to>
date Sat, 02 Aug 2008 23:10:42 +0800
parents 8fcf2d878ecd
children e598bc809c0f
line wrap: on
line diff
--- a/src/X_main.c	Sat Aug 02 16:20:15 2008 +0800
+++ b/src/X_main.c	Sat Aug 02 23:10:42 2008 +0800
@@ -14,10 +14,11 @@
 
 void draw_path(cairo_t *cr, int w, int h) {
     redraw_man_t rdman;
-    shape_t *path1, *path2;
+    shape_t *path1, *path2, *path3;
     coord_t *coord1, *coord2;
-    paint_t *fill1, *fill2;
+    paint_t *fill1, *fill2, *fill3;
     paint_t *stroke;
+    grad_stop_t fill3_stops[3];
     int i;
 
     redraw_man_init(&rdman, cr);
@@ -48,6 +49,16 @@
     rdman_add_shape(&rdman, (shape_t *)path1, coord1);
     rdman_add_shape(&rdman, (shape_t *)path2, coord2);
 
+    
+    fill3 = paint_linear_new(&rdman, 50, 50, 150, 150);
+    grad_stop_init(fill3_stops, 0, 1, 0, 0, 0.5);
+    grad_stop_init(fill3_stops + 1, 0.5, 0, 1, 0, 0.5);
+    grad_stop_init(fill3_stops + 2, 1, 0, 0, 1, 0.5);
+    paint_linear_stops(fill3, 3, fill3_stops);
+    path3 = sh_path_new("M 50,50 L 50,150 L 150,150 L 150,50 z");
+    rdman_paint_fill(&rdman, fill3, path3);
+    rdman_add_shape(&rdman, (shape_t *)path3, rdman.root_coord);
+
     rdman_redraw_all(&rdman);
 
     XFlush(display);