[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
- Previous message: [cairo-commit] cairo-java ChangeLog,1.88,1.89
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Antialias.java, 1.3, 1.4 CairoException.java, 1.2,
1.3 CairoObject.java, 1.4, 1.5 Content.java, 1.3,
1.4 Context.java, 1.12, 1.13 Extend.java, 1.5,
1.6 FillRule.java, 1.5, 1.6 Filter.java, 1.5,
1.6 FontExtents.java, 1.6, 1.7 FontFace.java, 1.6,
1.7 FontOptions.java, 1.4, 1.5 FontSlant.java, 1.4,
1.5 FontWeight.java, 1.4, 1.5 Format.java, 1.4, 1.5 Glyph.java,
1.8, 1.9 Gradient.java, 1.4, 1.5 HintMetrics.java, 1.3,
1.4 HintStyle.java, 1.3, 1.4 ImageSurface.java, 1.12,
1.13 LineCap.java, 1.4, 1.5 LineJoin.java, 1.4,
1.5 LinearGradient.java, 1.2, 1.3 Matrix.java, 1.12,
1.13 Operator.java, 1.6, 1.7 PDFSurface.java, 1.7,
1.8 Path.java, 1.3, 1.4 PathElement.java, 1.3,
1.4 PathElementType.java, 1.3, 1.4 PathIterator.java, 1.2,
1.3 Pattern.java, 1.10, 1.11 Point.java, 1.3,
1.4 RadialGradient.java, 1.2, 1.3 Rectangle.java, 1.2,
1.3 ScaledFont.java, 1.6, 1.7 Status.java, 1.13,
1.14 SubpixelOrder.java, 1.3, 1.4 Surface.java, 1.18,
1.19 SurfacePattern.java, 1.3, 1.4 TextExtents.java, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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);
+ }
+
}
- Previous message: [cairo-commit] cairo-java ChangeLog,1.88,1.89
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Antialias.java, 1.3, 1.4 CairoException.java, 1.2,
1.3 CairoObject.java, 1.4, 1.5 Content.java, 1.3,
1.4 Context.java, 1.12, 1.13 Extend.java, 1.5,
1.6 FillRule.java, 1.5, 1.6 Filter.java, 1.5,
1.6 FontExtents.java, 1.6, 1.7 FontFace.java, 1.6,
1.7 FontOptions.java, 1.4, 1.5 FontSlant.java, 1.4,
1.5 FontWeight.java, 1.4, 1.5 Format.java, 1.4, 1.5 Glyph.java,
1.8, 1.9 Gradient.java, 1.4, 1.5 HintMetrics.java, 1.3,
1.4 HintStyle.java, 1.3, 1.4 ImageSurface.java, 1.12,
1.13 LineCap.java, 1.4, 1.5 LineJoin.java, 1.4,
1.5 LinearGradient.java, 1.2, 1.3 Matrix.java, 1.12,
1.13 Operator.java, 1.6, 1.7 PDFSurface.java, 1.7,
1.8 Path.java, 1.3, 1.4 PathElement.java, 1.3,
1.4 PathElementType.java, 1.3, 1.4 PathIterator.java, 1.2,
1.3 Pattern.java, 1.10, 1.11 Point.java, 1.3,
1.4 RadialGradient.java, 1.2, 1.3 Rectangle.java, 1.2,
1.3 ScaledFont.java, 1.6, 1.7 Status.java, 1.13,
1.14 SubpixelOrder.java, 1.3, 1.4 Surface.java, 1.18,
1.19 SurfacePattern.java, 1.3, 1.4 TextExtents.java, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list