# HG changeset patch # User Anton Epple # Date 1369237741 -7200 # Node ID 425c0c9ff88c3f1b260b99e88839c984ed6cddad # Parent 2dc980517b3613abbf67fb08c1a023c843631b3c updated API diff -r 2dc980517b36 -r 425c0c9ff88c javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java Wed May 22 16:37:51 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java Wed May 22 17:49:01 2013 +0200 @@ -1,6 +1,19 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. +/** + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach + * + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. Look for COPYING file in the top folder. If not, see + * http://opensource.org/licenses/GPL-2.0. */ package net.java.html.canvas; @@ -11,6 +24,7 @@ * @author antonepple */ public interface GraphicsEnvironment { + public void arc(double centerX, double centerY, double startAngle, @@ -76,7 +90,7 @@ public String getFillStyle(); - public void setFillStyle(Pattern style); + public void setFillStyle(Style style); public void setStrokeStyle(String style); @@ -161,9 +175,11 @@ public Pattern createPattern(ImageData image, String repeat); public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); - + + public void addColorStop(LinearGradient gradient, double position, String color); + public ImageData getImageForPath(String path); - + public int getHeight(); public int getWidth(); @@ -171,5 +187,4 @@ public void setHeight(int height); public void setWidth(int width); - } diff -r 2dc980517b36 -r 425c0c9ff88c javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java Wed May 22 16:37:51 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java Wed May 22 17:49:01 2013 +0200 @@ -17,12 +17,64 @@ */ package net.java.html.canvas; +import java.util.HashMap; + /** * * @author antonepple */ -public interface LinearGradient extends Pattern{ +public class LinearGradient implements Style { - void addColorStop(double position, String color); + HashMap stops; + + double x0, y0, x1, y1; + + void addColorStop(double position, String color){ + if (stops == null) stops = new HashMap<>(); + stops.put(position, color); + } + + public HashMap getStops() { + return stops; + } + + public void setStops(HashMap stops) { + this.stops = stops; + } + + public double getX0() { + return x0; + } + + public void setX0(double x0) { + this.x0 = x0; + } + + public double getY0() { + return y0; + } + + public void setY0(double y0) { + this.y0 = y0; + } + + public double getX1() { + return x1; + } + + public void setX1(double x1) { + this.x1 = x1; + } + + public double getY1() { + return y1; + } + + public void setY1(double y1) { + this.y1 = y1; + } + + + } diff -r 2dc980517b36 -r 425c0c9ff88c javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java Wed May 22 16:37:51 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java Wed May 22 17:49:01 2013 +0200 @@ -21,6 +21,27 @@ * * @author antonepple */ -public interface Pattern { +public class Pattern implements Style{ + + ImageData imageData; + String repeat; + + public ImageData getImageData() { + return imageData; + } + + public void setImageData(ImageData imageData) { + this.imageData = imageData; + } + + public String getRepeat() { + return repeat; + } + + public void setRepeat(String repeat) { + this.repeat = repeat; + } + + } diff -r 2dc980517b36 -r 425c0c9ff88c javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java Wed May 22 16:37:51 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java Wed May 22 17:49:01 2013 +0200 @@ -21,8 +21,25 @@ * * @author antonepple */ -public interface RadialGradient extends LinearGradient{ +public class RadialGradient extends LinearGradient{ + double r0, r1; - void addColorStop(double position, String color); + public double getR0() { + return r0; + } + + public void setR0(double r0) { + this.r0 = r0; + } + + public double getR1() { + return r1; + } + + public void setR1(double r1) { + this.r1 = r1; + } + + } diff -r 2dc980517b36 -r 425c0c9ff88c javaquery/canvas/src/main/java/net/java/html/canvas/Style.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Wed May 22 17:49:01 2013 +0200 @@ -0,0 +1,26 @@ +/** + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach + * + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. Look for COPYING file in the top folder. If not, see + * http://opensource.org/licenses/GPL-2.0. + */ +package net.java.html.canvas; + +/** + * + * @author antonepple + */ +public interface Style { + +}