updated API canvas
authorAnton Epple <toni.epple@eppleton.de>
Wed, 22 May 2013 17:49:01 +0200
branchcanvas
changeset 1129425c0c9ff88c
parent 1128 2dc980517b36
child 1130 6790eb381615
updated API
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java
javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java
javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java
javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java
javaquery/canvas/src/main/java/net/java/html/canvas/Style.java
     1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java	Wed May 22 16:37:51 2013 +0200
     1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java	Wed May 22 17:49:01 2013 +0200
     1.3 @@ -1,6 +1,19 @@
     1.4 -/*
     1.5 - * To change this template, choose Tools | Templates
     1.6 - * and open the template in the editor.
     1.7 +/**
     1.8 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     1.9 + * <jaroslav.tulach@apidesign.org>
    1.10 + *
    1.11 + * This program is free software: you can redistribute it and/or modify it under
    1.12 + * the terms of the GNU General Public License as published by the Free Software
    1.13 + * Foundation, version 2 of the License.
    1.14 + *
    1.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
    1.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1.18 + * details.
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License along with
    1.21 + * this program. Look for COPYING file in the top folder. If not, see
    1.22 + * http://opensource.org/licenses/GPL-2.0.
    1.23   */
    1.24  package net.java.html.canvas;
    1.25  
    1.26 @@ -11,6 +24,7 @@
    1.27   * @author antonepple
    1.28   */
    1.29  public interface GraphicsEnvironment {
    1.30 +
    1.31      public void arc(double centerX,
    1.32              double centerY,
    1.33              double startAngle,
    1.34 @@ -76,7 +90,7 @@
    1.35  
    1.36      public String getFillStyle();
    1.37  
    1.38 -    public void setFillStyle(Pattern style);
    1.39 +    public void setFillStyle(Style style);
    1.40  
    1.41      public void setStrokeStyle(String style);
    1.42  
    1.43 @@ -161,9 +175,11 @@
    1.44      public Pattern createPattern(ImageData image, String repeat);
    1.45  
    1.46      public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
    1.47 -    
    1.48 +
    1.49 +    public void addColorStop(LinearGradient gradient, double position, String color);
    1.50 +
    1.51      public ImageData getImageForPath(String path);
    1.52 -    
    1.53 +
    1.54      public int getHeight();
    1.55  
    1.56      public int getWidth();
    1.57 @@ -171,5 +187,4 @@
    1.58      public void setHeight(int height);
    1.59  
    1.60      public void setWidth(int width);
    1.61 -    
    1.62  }
     2.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java	Wed May 22 16:37:51 2013 +0200
     2.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java	Wed May 22 17:49:01 2013 +0200
     2.3 @@ -17,12 +17,64 @@
     2.4   */
     2.5  package net.java.html.canvas;
     2.6  
     2.7 +import java.util.HashMap;
     2.8 +
     2.9  /**
    2.10   *
    2.11   * @author antonepple
    2.12   */
    2.13 -public interface LinearGradient extends Pattern{
    2.14 +public class LinearGradient implements Style {
    2.15  
    2.16 -    void addColorStop(double position, String color);
    2.17 +    HashMap<Double,String> stops;
    2.18 +    
    2.19 +    double x0, y0, x1, y1;
    2.20 +
    2.21 +    void addColorStop(double position, String color){
    2.22 +        if (stops == null) stops = new HashMap<>();
    2.23 +        stops.put(position, color);
    2.24 +    }
    2.25 +
    2.26 +    public HashMap<Double, String> getStops() {
    2.27 +        return stops;
    2.28 +    }
    2.29 +
    2.30 +    public void setStops(HashMap<Double, String> stops) {
    2.31 +        this.stops = stops;
    2.32 +    }
    2.33 +
    2.34 +    public double getX0() {
    2.35 +        return x0;
    2.36 +    }
    2.37 +
    2.38 +    public void setX0(double x0) {
    2.39 +        this.x0 = x0;
    2.40 +    }
    2.41 +
    2.42 +    public double getY0() {
    2.43 +        return y0;
    2.44 +    }
    2.45 +
    2.46 +    public void setY0(double y0) {
    2.47 +        this.y0 = y0;
    2.48 +    }
    2.49 +
    2.50 +    public double getX1() {
    2.51 +        return x1;
    2.52 +    }
    2.53 +
    2.54 +    public void setX1(double x1) {
    2.55 +        this.x1 = x1;
    2.56 +    }
    2.57 +
    2.58 +    public double getY1() {
    2.59 +        return y1;
    2.60 +    }
    2.61 +
    2.62 +    public void setY1(double y1) {
    2.63 +        this.y1 = y1;
    2.64 +    }
    2.65 +    
    2.66 +    
    2.67 +    
    2.68      
    2.69  }
     3.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java	Wed May 22 16:37:51 2013 +0200
     3.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java	Wed May 22 17:49:01 2013 +0200
     3.3 @@ -21,6 +21,27 @@
     3.4   *
     3.5   * @author antonepple
     3.6   */
     3.7 -public interface Pattern {
     3.8 +public class  Pattern implements Style{
     3.9 +    
    3.10 +    ImageData imageData; 
    3.11 +    String repeat;
    3.12 +
    3.13 +    public ImageData getImageData() {
    3.14 +        return imageData;
    3.15 +    }
    3.16 +
    3.17 +    public void setImageData(ImageData imageData) {
    3.18 +        this.imageData = imageData;
    3.19 +    }
    3.20 +
    3.21 +    public String getRepeat() {
    3.22 +        return repeat;
    3.23 +    }
    3.24 +
    3.25 +    public void setRepeat(String repeat) {
    3.26 +        this.repeat = repeat;
    3.27 +    }
    3.28 +    
    3.29 +    
    3.30      
    3.31  }
     4.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java	Wed May 22 16:37:51 2013 +0200
     4.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/RadialGradient.java	Wed May 22 17:49:01 2013 +0200
     4.3 @@ -21,8 +21,25 @@
     4.4   *
     4.5   * @author antonepple
     4.6   */
     4.7 -public interface RadialGradient extends LinearGradient{
     4.8 +public class RadialGradient extends LinearGradient{
     4.9 +    double r0, r1;
    4.10  
    4.11 -    void addColorStop(double position, String color);
    4.12 +    public double getR0() {
    4.13 +        return r0;
    4.14 +    }
    4.15 +
    4.16 +    public void setR0(double r0) {
    4.17 +        this.r0 = r0;
    4.18 +    }
    4.19 +
    4.20 +    public double getR1() {
    4.21 +        return r1;
    4.22 +    }
    4.23 +
    4.24 +    public void setR1(double r1) {
    4.25 +        this.r1 = r1;
    4.26 +    }
    4.27 +    
    4.28 + 
    4.29      
    4.30  }
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java	Wed May 22 17:49:01 2013 +0200
     5.3 @@ -0,0 +1,26 @@
     5.4 +/**
     5.5 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     5.6 + * <jaroslav.tulach@apidesign.org>
     5.7 + *
     5.8 + * This program is free software: you can redistribute it and/or modify it under
     5.9 + * the terms of the GNU General Public License as published by the Free Software
    5.10 + * Foundation, version 2 of the License.
    5.11 + *
    5.12 + * This program is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.14 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    5.15 + * details.
    5.16 + *
    5.17 + * You should have received a copy of the GNU General Public License along with
    5.18 + * this program. Look for COPYING file in the top folder. If not, see
    5.19 + * http://opensource.org/licenses/GPL-2.0.
    5.20 + */
    5.21 +package net.java.html.canvas;
    5.22 +
    5.23 +/**
    5.24 + *
    5.25 + * @author antonepple
    5.26 + */
    5.27 +public interface Style {
    5.28 +    
    5.29 +}