[cairo-commit] cairo-java/test/snippets Snippets.java,1.6,1.7

Jeffrey Morgan commit at pdx.freedesktop.org
Mon May 9 08:38:26 PDT 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/test/snippets
In directory gabe:/tmp/cvs-serv8044a/test/snippets

Modified Files:
	Snippets.java 
Log Message:
added pattern hierarchy

Index: Snippets.java
===================================================================
RCS file: /cvs/cairo/cairo-java/test/snippets/Snippets.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Snippets.java	9 May 2005 14:47:03 -0000	1.6
+++ Snippets.java	9 May 2005 15:38:24 -0000	1.7
@@ -17,8 +17,9 @@
 import org.freedesktop.cairo.FontWeight;
 import org.freedesktop.cairo.LineCap;
 import org.freedesktop.cairo.LineJoin;
-import org.freedesktop.cairo.Pattern;
+import org.freedesktop.cairo.LinearGradient;
 import org.freedesktop.cairo.Point;
+import org.freedesktop.cairo.RadialGradient;
 import org.freedesktop.cairo.Rectangle;
 import org.freedesktop.cairo.TextExtents;
 
@@ -275,21 +276,19 @@
 		
 		normalize (cr, width, height);
 
-		Pattern pat = new Pattern(0.0, 0.0, 0.0, 1.0);
-		pat.addColorStop(1, 0, 0, 0, 1);
-		pat.addColorStop(0, 1, 1, 1, 1);
+		LinearGradient lg = new LinearGradient(0.0, 0.0, 0.0, 1.0);
+		lg.addColorStop(1, 0, 0, 0, 1);
+		lg.addColorStop(0, 1, 1, 1, 1);
 		cr.rectangle(new Rectangle(0,0,1,1));
-		cr.setSource(pat);
+		cr.setSource(lg);
 		cr.fill();
 
-		pat.dispose();
-		pat = new Pattern(0.45, 0.4, 0.1, 0.4, 0.4, 0.5);
-		pat.addColorStop(0, 1, 1, 1, 1);
-		pat.addColorStop(1, 0, 0, 0, 1);
-		cr.setSource(pat);
+		RadialGradient rg = new RadialGradient(0.45, 0.4, 0.1, 0.4, 0.4, 0.5);
+		rg.addColorStop(0, 1, 1, 1, 1);
+		rg.addColorStop(1, 0, 0, 0, 1);
+		cr.setSource(rg);
 		cr.arc(0.5, 0.5, 0.3, 0, 2 * M_PI);
 		cr.fill();
-		pat.dispose();
 	}
 
 	/**




More information about the cairo-commit mailing list