[cairo-commit] cairo-java/test/kapow Kapow.java,1.15,1.16
Jeffrey Morgan
commit at pdx.freedesktop.org
Mon May 9 07:47:10 PDT 2005
Committed by: kuzman
Update of /cvs/cairo/cairo-java/test/kapow
In directory gabe:/tmp/cvs-serv22049/test/kapow
Modified Files:
Kapow.java
Log Message:
Continued API restructuring and cleanup
Index: Kapow.java
===================================================================
RCS file: /cvs/cairo/cairo-java/test/kapow/Kapow.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Kapow.java 7 May 2005 00:27:02 -0000 1.15
+++ Kapow.java 9 May 2005 14:47:03 -0000 1.16
@@ -12,12 +12,11 @@
import org.freedesktop.cairo.Context;
import org.freedesktop.cairo.FontSlant;
import org.freedesktop.cairo.FontWeight;
-import org.freedesktop.cairo.Format;
import org.freedesktop.cairo.Pattern;
import org.freedesktop.cairo.Point;
-import org.freedesktop.cairo.RGBColor;
import org.freedesktop.cairo.Surface;
import org.freedesktop.cairo.TextExtents;
+import org.w3c.dom.css.RGBColor;
/**
*/
@@ -36,11 +35,6 @@
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;
- private RGBColor black = new RGBColor(0,0,0);
- private RGBColor white = new RGBColor(1,1,1);
- private RGBColor red = new RGBColor(1,0,0);
- private RGBColor yellow = new RGBColor(1,1,0.2);
- private RGBColor purple = new RGBColor(0,0,0.4);
public Kapow(String text) throws Exception {
Surface surface = new Surface();
@@ -50,21 +44,21 @@
cr.save();
cr.translate(SHADOW_OFFSET, SHADOW_OFFSET);
makeStarPath();
- cr.setSourceRGBA(black, 0.5);
+ cr.setSourceRGBA(0, 0, 0, 0.5);
cr.fill();
cr.restore();
makeStarPath();
- cr.setSourceRGBA(black, 2);
+ cr.setSourceRGBA(0, 0, 0, 2);
Pattern pattern = new Pattern(IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2,
10, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, 230);
- pattern.addColorStop(0, yellow, 1);
- pattern.addColorStop(1, red, 1);
+ pattern.addColorStop(0, 1, 1, 0.2, 1);
+ pattern.addColorStop(1, 1, 0, 0, 1);
cr.setSource(pattern);
cr.fill();
makeStarPath();
- cr.setSourceRGB(black);
+ cr.setSourceRGB(0, 0, 0);
cr.stroke();
cr.selectFontFace("Sans", FontSlant.NORMAL, FontWeight.BOLD);
@@ -78,18 +72,17 @@
pattern = new Pattern(IMAGE_WIDTH / 2 - 10, IMAGE_HEIGHT / 4,
IMAGE_WIDTH / 2 + 10, 3 * IMAGE_HEIGHT / 4);
- pattern.addColorStop(0, white, 1);
- pattern.addColorStop(1, purple, 1);
+ pattern.addColorStop(0, 1, 1, 1, 1);
+ pattern.addColorStop(1, 0, 0, 0.4, 1);
cr.setSource(pattern);
cr.fill();
makeTextPath(point, text);
- cr.setSourceRGB(black);
+ cr.setSourceRGB(0, 0, 0);
cr.stroke();
//surface.write(filename);
- cr.dispose();
}
private void makeStarPath() {
More information about the cairo-commit
mailing list