moved GRaphicsEnvironment to SPI package canvas
authorAnton Epple <toni.epple@eppleton.de>
Thu, 23 May 2013 15:36:42 +0200
branchcanvas
changeset 1136591d06d8e06f
parent 1135 836bc1845c65
child 1137 964e42c9448d
moved GRaphicsEnvironment to SPI package
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java
javaquery/canvas/src/main/java/net/java/html/canvas/Image.java
javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java
javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java
javaquery/canvas/src/main/java/net/java/html/canvas/Style.java
javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java
     1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Thu May 23 15:33:14 2013 +0200
     1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Thu May 23 15:36:42 2013 +0200
     1.3 @@ -17,6 +17,7 @@
     1.4   */
     1.5  package net.java.html.canvas;
     1.6  
     1.7 +import net.java.html.canvas.spi.GraphicsEnvironment;
     1.8  import java.awt.Dimension;
     1.9  
    1.10  /**
    1.11 @@ -132,15 +133,15 @@
    1.12          graphicsEnvironmentImpl.scale(x, y);
    1.13      }
    1.14  
    1.15 -    public void drawImage(Image image, double x, double y){
    1.16 +    public void drawImage(ImageData image, double x, double y){
    1.17          graphicsEnvironmentImpl.drawImage(image, x, y);
    1.18      }
    1.19  
    1.20 -    public void drawImage(Image image, double x, double y, double width, double height){
    1.21 +    public void drawImage(ImageData image, double x, double y, double width, double height){
    1.22          graphicsEnvironmentImpl.drawImage(image, x, y, width, height);
    1.23      }
    1.24  
    1.25 -    public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){
    1.26 +    public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){
    1.27          graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height);
    1.28      }
    1.29  
    1.30 @@ -272,7 +273,7 @@
    1.31  //        return graphicsEnvironmentImpl.createImageData(x, y);
    1.32  //    }
    1.33  //
    1.34 -//    public ImageData createImageData(Image imageData){
    1.35 +//    public ImageData createImageData(ImageData imageData){
    1.36  //        return graphicsEnvironmentImpl.createImageData(imageData);
    1.37  //    }
    1.38  //
    1.39 @@ -308,7 +309,7 @@
    1.40          return new LinearGradient(x0, y0, x1, y1);
    1.41      }
    1.42  
    1.43 -    public Pattern createPattern(Image image, String repeat){
    1.44 +    public Pattern createPattern(ImageData image, String repeat){
    1.45          return new Pattern(image, repeat);
    1.46      }
    1.47  
    1.48 @@ -316,9 +317,9 @@
    1.49          return new RadialGradient(x0, y0, r0, x1, y1, r1);
    1.50      }
    1.51  
    1.52 -    public Image getImageDataForPath(String path){
    1.53 -        return graphicsEnvironmentImpl.getImageForPath(path);
    1.54 -    }
    1.55 +//    public ImageData getImageDataForPath(String path){
    1.56 +//        return graphicsEnvironmentImpl.getImageForPath(path);
    1.57 +//    }
    1.58  
    1.59      public int getHeight(){
    1.60          return graphicsEnvironmentImpl.getHeight();
     2.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java	Thu May 23 15:33:14 2013 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,182 +0,0 @@
     2.4 -/**
     2.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     2.6 - * <jaroslav.tulach@apidesign.org>
     2.7 - *
     2.8 - * This program is free software: you can redistribute it and/or modify it under
     2.9 - * the terms of the GNU General Public License as published by the Free Software
    2.10 - * Foundation, version 2 of the License.
    2.11 - *
    2.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
    2.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    2.15 - * details.
    2.16 - *
    2.17 - * You should have received a copy of the GNU General Public License along with
    2.18 - * this program. Look for COPYING file in the top folder. If not, see
    2.19 - * http://opensource.org/licenses/GPL-2.0.
    2.20 - */
    2.21 -package net.java.html.canvas;
    2.22 -
    2.23 -import java.awt.Dimension;
    2.24 -
    2.25 -/**
    2.26 - *
    2.27 - * @author antonepple
    2.28 - */
    2.29 -public interface GraphicsEnvironment {
    2.30 -
    2.31 -    public void arc(double centerX,
    2.32 -            double centerY,
    2.33 -            double startAngle,
    2.34 -            double radius,
    2.35 -            double endAngle,
    2.36 -            boolean ccw);
    2.37 -
    2.38 -    public void arcTo(double x1,
    2.39 -            double y1,
    2.40 -            double x2,
    2.41 -            double y2,
    2.42 -            double r);
    2.43 -
    2.44 -    public boolean isPointInPath(double x, double y);
    2.45 -
    2.46 -    public void fill();
    2.47 -
    2.48 -    public void stroke();
    2.49 -
    2.50 -    public void beginPath();
    2.51 -
    2.52 -    public void closePath();
    2.53 -
    2.54 -    public void clip();
    2.55 -
    2.56 -    public void moveTo(double x, double y);
    2.57 -
    2.58 -    public void lineTo(double x, double y);
    2.59 -
    2.60 -    public void quadraticCurveTo(double cpx, double cpy, double x, double y);
    2.61 -
    2.62 -    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    2.63 -
    2.64 -    public void fillRect(double x, double y, double width, double height);
    2.65 -
    2.66 -    public void strokeRect(double x, double y, double width, double height);
    2.67 -
    2.68 -    public void clearRect(double x, double y, double width, double height);
    2.69 -
    2.70 -    public void rect(double x, double y, double width, double height);
    2.71 -
    2.72 -    public void save();
    2.73 -
    2.74 -    public void restore();
    2.75 -
    2.76 -    public void rotate(double angle);
    2.77 -
    2.78 -    public void transform(double a, double b, double c, double d, double e, double f);
    2.79 -
    2.80 -    public void setTransform(double a, double b, double c, double d, double e, double f);
    2.81 -
    2.82 -    public void translate(double x, double y);
    2.83 -
    2.84 -    public void scale(double x, double y);
    2.85 -
    2.86 -    public void drawImage(Image image, double x, double y);
    2.87 -
    2.88 -    public void drawImage(Image image, double x, double y, double width, double height);
    2.89 -
    2.90 -    public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
    2.91 -
    2.92 -    public void setFillStyle(String style);
    2.93 -
    2.94 -    public String getFillStyle();
    2.95 -
    2.96 -    public void setFillStyle(Style style);
    2.97 -
    2.98 -    public void setStrokeStyle(String style);
    2.99 -
   2.100 -    public void setStrokeStyle(Style style);
   2.101 -
   2.102 -    public void setShadowColor(String color);
   2.103 -
   2.104 -    public void setShadowBlur(double blur);
   2.105 -
   2.106 -    public void setShadowOffsetX(double x);
   2.107 -
   2.108 -    public void setShadowOffsetY(double y);
   2.109 -
   2.110 -    public String getStrokeStyle();
   2.111 -
   2.112 -    public String getShadowColor();
   2.113 -
   2.114 -    public double getShadowBlur();
   2.115 -
   2.116 -    public double getShadowOffsetX();
   2.117 -
   2.118 -    public double getShadowOffsetY();
   2.119 -
   2.120 -    public String getLineCap();
   2.121 -
   2.122 -    public void setLineCap(String style);
   2.123 -
   2.124 -    public String getLineJoin();
   2.125 -
   2.126 -    public void setLineJoin(String style);
   2.127 -
   2.128 -    public double getLineWidth();
   2.129 -
   2.130 -    public void setLineWidth(double width);
   2.131 -
   2.132 -    public double getMiterLimit();
   2.133 -
   2.134 -    public void setMiterLimit(double limit);
   2.135 -
   2.136 -    public String getFont();
   2.137 -
   2.138 -    public void setFont(String font);
   2.139 -
   2.140 -    public String getTextAlign();
   2.141 -
   2.142 -    public void setTextAlign(String textAlign);
   2.143 -
   2.144 -    public String getTextBaseline();
   2.145 -
   2.146 -    public void setTextBaseline(String textbaseline);
   2.147 -
   2.148 -    public void fillText(String text, double x, double y);
   2.149 -
   2.150 -    public void fillText(String text, double x, double y, double maxWidth);
   2.151 -
   2.152 -    public Dimension measureText(String text);
   2.153 -
   2.154 -    public void strokeText(String text, double x, double y);
   2.155 -
   2.156 -    public void strokeText(String text, double x, double y, double maxWidth);
   2.157 -
   2.158 -//    public ImageData createImageData(double x, double y);
   2.159 -//
   2.160 -//    public ImageData createImageData(Image imageData);
   2.161 -//
   2.162 -//    public ImageData getImageData(double x, double y, double width, double height);
   2.163 -//
   2.164 -//    public void putImageData(ImageData imageData, double x, double y);
   2.165 -//
   2.166 -//    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   2.167 -
   2.168 -    public void setGlobalAlpha(double alpha);
   2.169 -
   2.170 -    public double getGlobalAlpha();
   2.171 -
   2.172 -    public void setGlobalCompositeOperation(String operation);
   2.173 -
   2.174 -    public String getGlobalCompositeOperation();
   2.175 -
   2.176 -    public Image getImageForPath(String path);
   2.177 -
   2.178 -    public int getHeight();
   2.179 -
   2.180 -    public int getWidth();
   2.181 -
   2.182 -    public void setHeight(int height);
   2.183 -
   2.184 -    public void setWidth(int width);
   2.185 -}
     3.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Image.java	Thu May 23 15:33:14 2013 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,31 +0,0 @@
     3.4 -/**
     3.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     3.6 - * <jaroslav.tulach@apidesign.org>
     3.7 - *
     3.8 - * This program is free software: you can redistribute it and/or modify it under
     3.9 - * the terms of the GNU General Public License as published by the Free Software
    3.10 - * Foundation, version 2 of the License.
    3.11 - *
    3.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
    3.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    3.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    3.15 - * details.
    3.16 - *
    3.17 - * You should have received a copy of the GNU General Public License along with
    3.18 - * this program. Look for COPYING file in the top folder. If not, see
    3.19 - * http://opensource.org/licenses/GPL-2.0.
    3.20 - */
    3.21 -package net.java.html.canvas;
    3.22 -
    3.23 -/**
    3.24 - *
    3.25 - * @author antonepple
    3.26 - */
    3.27 -public interface Image {
    3.28 -
    3.29 -    public double getHeight();
    3.30 -
    3.31 -    public double getWidth();
    3.32 -    
    3.33 -    
    3.34 -}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java	Thu May 23 15:36:42 2013 +0200
     4.3 @@ -0,0 +1,31 @@
     4.4 +/**
     4.5 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     4.6 + * <jaroslav.tulach@apidesign.org>
     4.7 + *
     4.8 + * This program is free software: you can redistribute it and/or modify it under
     4.9 + * the terms of the GNU General Public License as published by the Free Software
    4.10 + * Foundation, version 2 of the License.
    4.11 + *
    4.12 + * This program is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.14 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    4.15 + * details.
    4.16 + *
    4.17 + * You should have received a copy of the GNU General Public License along with
    4.18 + * this program. Look for COPYING file in the top folder. If not, see
    4.19 + * http://opensource.org/licenses/GPL-2.0.
    4.20 + */
    4.21 +package net.java.html.canvas;
    4.22 +
    4.23 +/**
    4.24 + *
    4.25 + * @author antonepple
    4.26 + */
    4.27 +public interface ImageData {
    4.28 +
    4.29 +    public double getHeight();
    4.30 +
    4.31 +    public double getWidth();
    4.32 +    
    4.33 +    
    4.34 +}
     5.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java	Thu May 23 15:33:14 2013 +0200
     5.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java	Thu May 23 15:36:42 2013 +0200
     5.3 @@ -23,19 +23,19 @@
     5.4   */
     5.5   public final class Pattern extends Style{
     5.6      
     5.7 -    Image imageData; 
     5.8 +    ImageData imageData; 
     5.9      String repeat;
    5.10  
    5.11 -    Pattern(Image imageData, String repeat) {
    5.12 +    Pattern(ImageData imageData, String repeat) {
    5.13          this.imageData = imageData;
    5.14          this.repeat = repeat;
    5.15      }
    5.16      
    5.17 -    public Image getImageData() {
    5.18 +    public ImageData getImageData() {
    5.19          return imageData;
    5.20      }
    5.21  
    5.22 -    public void setImageData(Image imageData) {
    5.23 +    public void setImageData(ImageData imageData) {
    5.24          this.imageData = imageData;
    5.25      }
    5.26  
     6.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java	Thu May 23 15:33:14 2013 +0200
     6.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java	Thu May 23 15:36:42 2013 +0200
     6.3 @@ -34,7 +34,7 @@
     6.4          return new LinearGradient(x0, y0, x1, y1);
     6.5      }
     6.6      
     6.7 -    public static final Pattern createPattern(Image imageData, String repeat){
     6.8 +    public static final Pattern createPattern(ImageData imageData, String repeat){
     6.9          return new Pattern(imageData, repeat);
    6.10      }
    6.11      
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java	Thu May 23 15:36:42 2013 +0200
     7.3 @@ -0,0 +1,184 @@
     7.4 +/**
     7.5 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     7.6 + * <jaroslav.tulach@apidesign.org>
     7.7 + *
     7.8 + * This program is free software: you can redistribute it and/or modify it under
     7.9 + * the terms of the GNU General Public License as published by the Free Software
    7.10 + * Foundation, version 2 of the License.
    7.11 + *
    7.12 + * This program is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    7.14 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    7.15 + * details.
    7.16 + *
    7.17 + * You should have received a copy of the GNU General Public License along with
    7.18 + * this program. Look for COPYING file in the top folder. If not, see
    7.19 + * http://opensource.org/licenses/GPL-2.0.
    7.20 + */
    7.21 +package net.java.html.canvas.spi;
    7.22 +
    7.23 +import java.awt.Dimension;
    7.24 +import net.java.html.canvas.ImageData;
    7.25 +import net.java.html.canvas.Style;
    7.26 +
    7.27 +/**
    7.28 + * Provider API for Canvas. Implement this to add support for your platform.
    7.29 + * @author antonepple
    7.30 + */
    7.31 +public interface GraphicsEnvironment {
    7.32 +
    7.33 +    public void arc(double centerX,
    7.34 +            double centerY,
    7.35 +            double startAngle,
    7.36 +            double radius,
    7.37 +            double endAngle,
    7.38 +            boolean ccw);
    7.39 +
    7.40 +    public void arcTo(double x1,
    7.41 +            double y1,
    7.42 +            double x2,
    7.43 +            double y2,
    7.44 +            double r);
    7.45 +
    7.46 +    public boolean isPointInPath(double x, double y);
    7.47 +
    7.48 +    public void fill();
    7.49 +
    7.50 +    public void stroke();
    7.51 +
    7.52 +    public void beginPath();
    7.53 +
    7.54 +    public void closePath();
    7.55 +
    7.56 +    public void clip();
    7.57 +
    7.58 +    public void moveTo(double x, double y);
    7.59 +
    7.60 +    public void lineTo(double x, double y);
    7.61 +
    7.62 +    public void quadraticCurveTo(double cpx, double cpy, double x, double y);
    7.63 +
    7.64 +    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    7.65 +
    7.66 +    public void fillRect(double x, double y, double width, double height);
    7.67 +
    7.68 +    public void strokeRect(double x, double y, double width, double height);
    7.69 +
    7.70 +    public void clearRect(double x, double y, double width, double height);
    7.71 +
    7.72 +    public void rect(double x, double y, double width, double height);
    7.73 +
    7.74 +    public void save();
    7.75 +
    7.76 +    public void restore();
    7.77 +
    7.78 +    public void rotate(double angle);
    7.79 +
    7.80 +    public void transform(double a, double b, double c, double d, double e, double f);
    7.81 +
    7.82 +    public void setTransform(double a, double b, double c, double d, double e, double f);
    7.83 +
    7.84 +    public void translate(double x, double y);
    7.85 +
    7.86 +    public void scale(double x, double y);
    7.87 +
    7.88 +    public void drawImage(ImageData image, double x, double y);
    7.89 +
    7.90 +    public void drawImage(ImageData image, double x, double y, double width, double height);
    7.91 +
    7.92 +    public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
    7.93 +
    7.94 +    public void setFillStyle(String style);
    7.95 +
    7.96 +    public String getFillStyle();
    7.97 +
    7.98 +    public void setFillStyle(Style style);
    7.99 +
   7.100 +    public void setStrokeStyle(String style);
   7.101 +
   7.102 +    public void setStrokeStyle(Style style);
   7.103 +
   7.104 +    public void setShadowColor(String color);
   7.105 +
   7.106 +    public void setShadowBlur(double blur);
   7.107 +
   7.108 +    public void setShadowOffsetX(double x);
   7.109 +
   7.110 +    public void setShadowOffsetY(double y);
   7.111 +
   7.112 +    public String getStrokeStyle();
   7.113 +
   7.114 +    public String getShadowColor();
   7.115 +
   7.116 +    public double getShadowBlur();
   7.117 +
   7.118 +    public double getShadowOffsetX();
   7.119 +
   7.120 +    public double getShadowOffsetY();
   7.121 +
   7.122 +    public String getLineCap();
   7.123 +
   7.124 +    public void setLineCap(String style);
   7.125 +
   7.126 +    public String getLineJoin();
   7.127 +
   7.128 +    public void setLineJoin(String style);
   7.129 +
   7.130 +    public double getLineWidth();
   7.131 +
   7.132 +    public void setLineWidth(double width);
   7.133 +
   7.134 +    public double getMiterLimit();
   7.135 +
   7.136 +    public void setMiterLimit(double limit);
   7.137 +
   7.138 +    public String getFont();
   7.139 +
   7.140 +    public void setFont(String font);
   7.141 +
   7.142 +    public String getTextAlign();
   7.143 +
   7.144 +    public void setTextAlign(String textAlign);
   7.145 +
   7.146 +    public String getTextBaseline();
   7.147 +
   7.148 +    public void setTextBaseline(String textbaseline);
   7.149 +
   7.150 +    public void fillText(String text, double x, double y);
   7.151 +
   7.152 +    public void fillText(String text, double x, double y, double maxWidth);
   7.153 +
   7.154 +    public Dimension measureText(String text);
   7.155 +
   7.156 +    public void strokeText(String text, double x, double y);
   7.157 +
   7.158 +    public void strokeText(String text, double x, double y, double maxWidth);
   7.159 +
   7.160 +//    public ImageData createImageData(double x, double y);
   7.161 +//
   7.162 +//    public ImageData createImageData(ImageData imageData);
   7.163 +//
   7.164 +//    public ImageData getImageData(double x, double y, double width, double height);
   7.165 +//
   7.166 +//    public void putImageData(ImageData imageData, double x, double y);
   7.167 +//
   7.168 +//    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   7.169 +
   7.170 +    public void setGlobalAlpha(double alpha);
   7.171 +
   7.172 +    public double getGlobalAlpha();
   7.173 +
   7.174 +    public void setGlobalCompositeOperation(String operation);
   7.175 +
   7.176 +    public String getGlobalCompositeOperation();
   7.177 +
   7.178 +//    public ImageData getImageForPath(String path);
   7.179 +
   7.180 +    public int getHeight();
   7.181 +
   7.182 +    public int getWidth();
   7.183 +
   7.184 +    public void setHeight(int height);
   7.185 +
   7.186 +    public void setWidth(int width);
   7.187 +}