[cairo-commit] cairo-java/test/kapow Kapow.java,1.18,1.19

Andrew Frederick Cowie commit at pdx.freedesktop.org
Sun Feb 12 01:05:46 PST 2006


Committed by: afcowie

Update of /cvs/cairo/cairo-java/test/kapow
In directory gabe:/tmp/cvs-serv21601/test/kapow

Modified Files:
	Kapow.java 
Log Message:
Update format setting from Eclipse default to Java default; format test cases.


Index: Kapow.java
===================================================================
RCS file: /cvs/cairo/cairo-java/test/kapow/Kapow.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Kapow.java	17 Aug 2005 00:34:31 -0000	1.18
+++ Kapow.java	12 Feb 2006 09:05:44 -0000	1.19
@@ -1,5 +1,5 @@
 /*
-s * Java-Gnome Bindings Library
+ s * Java-Gnome Bindings Library
  *
  * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
  *
@@ -23,102 +23,117 @@
 /**
  */
 public class Kapow {
-	
-	public Context cr;
-	private String filename = "kapow.png";
-	public int IMAGE_WIDTH = 460;
-	public int IMAGE_HEIGHT = 308;
-	private int SPIKES = 10;
-	private int SHADOW_OFFSET = 10;
-	private int X_FUZZ = 16;
-	private int Y_FUZZ = 16;
-	private double X_OUTER_RADIUS = (IMAGE_WIDTH / 2 - X_FUZZ - SHADOW_OFFSET);
-	private double Y_OUTER_RADIUS = (IMAGE_HEIGHT / 2 - Y_FUZZ - SHADOW_OFFSET);
-	private double X_INNER_RADIUS = (X_OUTER_RADIUS * 0.7);
-	private double Y_INNER_RADIUS = (Y_OUTER_RADIUS * 0.7);
-	private int RAND_MAX = Integer.MAX_VALUE;
 
-	public Kapow(String text) throws Exception {
-		Surface surface = new ImageSurface(Format.ARGB32, IMAGE_WIDTH, IMAGE_HEIGHT);
-		cr = new Context(surface);
+    public Context cr;
 
-		cr.setLineWidth(2);
-		cr.save();
-		cr.translate(SHADOW_OFFSET, SHADOW_OFFSET);
-		makeStarPath();
-		cr.setSourceRGBA(0, 0, 0, 0.5);
-		cr.fill();
-		cr.restore();
+    private String filename = "kapow.png";
 
-		makeStarPath();
-		cr.setSourceRGBA(0, 0, 0, 2);
-        RadialGradient rg = new RadialGradient(IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2,
-					10, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, 230);
-		rg.addColorStop(0, 1, 1, 0.2, 1);
-		rg.addColorStop(1, 1, 0, 0, 1);
-		cr.setSource(rg);
-		cr.fill();
+    public int IMAGE_WIDTH = 460;
 
-		makeStarPath();
-		cr.setSourceRGB(0, 0, 0);
-		cr.stroke();
+    public int IMAGE_HEIGHT = 308;
 
-		cr.selectFontFace("Sans", FontSlant.NORMAL, FontWeight.BOLD);
-		cr.setFontSize(50);
-		TextExtents extents = cr.textExtents(text);
+    private int SPIKES = 10;
+
+    private int SHADOW_OFFSET = 10;
+
+    private int X_FUZZ = 16;
+
+    private int Y_FUZZ = 16;
+
+    private double X_OUTER_RADIUS = (IMAGE_WIDTH / 2 - X_FUZZ - SHADOW_OFFSET);
+
+    private double Y_OUTER_RADIUS = (IMAGE_HEIGHT / 2 - Y_FUZZ - SHADOW_OFFSET);
+
+    private double X_INNER_RADIUS = (X_OUTER_RADIUS * 0.7);
+
+    private double Y_INNER_RADIUS = (Y_OUTER_RADIUS * 0.7);
+
+    private int RAND_MAX = Integer.MAX_VALUE;
+
+    public Kapow(String text) throws Exception {
+        Surface surface = new ImageSurface(Format.ARGB32, IMAGE_WIDTH,
+                IMAGE_HEIGHT);
+        cr = new Context(surface);
+
+        cr.setLineWidth(2);
+        cr.save();
+        cr.translate(SHADOW_OFFSET, SHADOW_OFFSET);
+        makeStarPath();
+        cr.setSourceRGBA(0, 0, 0, 0.5);
+        cr.fill();
+        cr.restore();
+
+        makeStarPath();
+        cr.setSourceRGBA(0, 0, 0, 2);
+        RadialGradient rg = new RadialGradient(IMAGE_WIDTH / 2,
+                IMAGE_HEIGHT / 2, 10, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, 230);
+        rg.addColorStop(0, 1, 1, 0.2, 1);
+        rg.addColorStop(1, 1, 0, 0, 1);
+        cr.setSource(rg);
+        cr.fill();
+
+        makeStarPath();
+        cr.setSourceRGB(0, 0, 0);
+        cr.stroke();
+
+        cr.selectFontFace("Sans", FontSlant.NORMAL, FontWeight.BOLD);
+        cr.setFontSize(50);
+        TextExtents extents = cr.textExtents(text);
         Point point = new Point();
-		point.setX(IMAGE_WIDTH / 2 - (extents.getWidth() / 2 + extents.getXBearing()));
-		point.setY(IMAGE_HEIGHT / 2 - (extents.getHeight() / 2 + extents.getYBearing()));
+        point.setX(IMAGE_WIDTH / 2
+                - (extents.getWidth() / 2 + extents.getXBearing()));
+        point.setY(IMAGE_HEIGHT / 2
+                - (extents.getHeight() / 2 + extents.getYBearing()));
 
-		makeTextPath(point, text);
+        makeTextPath(point, text);
 
-        LinearGradient lg = new LinearGradient(IMAGE_WIDTH / 2 - 10, IMAGE_HEIGHT / 4,
-					IMAGE_WIDTH / 2 + 10, 3 * IMAGE_HEIGHT / 4);
-		lg.addColorStop(0, 1, 1, 1, 1);
-		lg.addColorStop(1, 0, 0, 0.4, 1);
-		cr.setSource(lg);
+        LinearGradient lg = new LinearGradient(IMAGE_WIDTH / 2 - 10,
+                IMAGE_HEIGHT / 4, IMAGE_WIDTH / 2 + 10, 3 * IMAGE_HEIGHT / 4);
+        lg.addColorStop(0, 1, 1, 1, 1);
+        lg.addColorStop(1, 0, 0, 0.4, 1);
+        cr.setSource(lg);
 
-		cr.fill();
+        cr.fill();
 
-		makeTextPath(point, text);
-		cr.setSourceRGB(0, 0, 0);
-		cr.stroke();
-		
-		surface.writeToPNG(filename);
-	}
-	
-	private void makeStarPath() {
-	    for (int i = 0; i < SPIKES * 2; i++) {
+        makeTextPath(point, text);
+        cr.setSourceRGB(0, 0, 0);
+        cr.stroke();
+
+        surface.writeToPNG(filename);
+    }
+
+    private void makeStarPath() {
+        for (int i = 0; i < SPIKES * 2; i++) {
             Point p = new Point();
-	    	p.setX(IMAGE_WIDTH / 2 + Math.cos(Math.PI * i / SPIKES) * X_INNER_RADIUS +
-	    			Math.random() * X_FUZZ / RAND_MAX);
-	    	p.setY(IMAGE_HEIGHT / 2 + Math.sin(Math.PI * i / SPIKES) * Y_INNER_RADIUS +
-	    			Math.random() * Y_FUZZ / RAND_MAX);
-	    	
-	    	if (0 == i)
-	    		cr.moveTo(p);
-	    	else
-	    		cr.lineTo(p);
+            p.setX(IMAGE_WIDTH / 2 + Math.cos(Math.PI * i / SPIKES)
+                    * X_INNER_RADIUS + Math.random() * X_FUZZ / RAND_MAX);
+            p.setY(IMAGE_HEIGHT / 2 + Math.sin(Math.PI * i / SPIKES)
+                    * Y_INNER_RADIUS + Math.random() * Y_FUZZ / RAND_MAX);
 
-	    	i++;
-	    	p.setX(IMAGE_WIDTH / 2 + Math.cos(Math.PI * i / SPIKES) * X_OUTER_RADIUS +
-					Math.random() * X_FUZZ / RAND_MAX);
-	    	p.setY(IMAGE_HEIGHT / 2 + Math.sin(Math.PI * i / SPIKES) * Y_OUTER_RADIUS +
-					Math.random() * Y_FUZZ / RAND_MAX);
+            if (0 == i)
+                cr.moveTo(p);
+            else
+                cr.lineTo(p);
 
-	    	cr.lineTo(p);
-	    }
-	    cr.closePath();
-	}
-	
-	private void makeTextPath(Point point, String text) {
-	}
+            i++;
+            p.setX(IMAGE_WIDTH / 2 + Math.cos(Math.PI * i / SPIKES)
+                    * X_OUTER_RADIUS + Math.random() * X_FUZZ / RAND_MAX);
+            p.setY(IMAGE_HEIGHT / 2 + Math.sin(Math.PI * i / SPIKES)
+                    * Y_OUTER_RADIUS + Math.random() * Y_FUZZ / RAND_MAX);
 
-	public static void main(String[] args) throws Exception {
+            cr.lineTo(p);
+        }
+        cr.closePath();
+    }
+
+    private void makeTextPath(Point point, String text) {
+    }
+
+    public static void main(String[] args) throws Exception {
         String text = "Kapow";
-		if (args.length == 1)
-			text = args[0];
-		new Kapow(text);
-	}
-    
+        if (args.length == 1)
+            text = args[0];
+        new Kapow(text);
+    }
+
 }



More information about the cairo-commit mailing list