javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
branchcanvas
changeset 1111 8c88d0f187d8
parent 1109 b17053d0671d
child 1121 dbc985f7226e
     1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Fri May 17 11:00:23 2013 +0200
     1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Fri May 17 12:06:36 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 @@ -12,175 +25,162 @@
    1.27   */
    1.28  public interface GraphicsContext {
    1.29  
    1.30 -    @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"}, body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
    1.31 -    void arc(double centerX, double centerY, double startAngle, double radius, double endAngle, boolean ccw);
    1.32 +    public void arc(double centerX,
    1.33 +            double centerY,
    1.34 +            double startAngle,
    1.35 +            double radius,
    1.36 +            double endAngle,
    1.37 +            boolean ccw);
    1.38  
    1.39 -    @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"}, body = "this._context().arcTo(x1,y1,x2,y2,r);")
    1.40 -    void arcTo(double x1, double y1, double x2, double y2, double r);
    1.41 +    public void arcTo(double x1,
    1.42 +            double y1,
    1.43 +            double x2,
    1.44 +            double y2,
    1.45 +            double r);
    1.46  
    1.47 -    @JavaScriptBody(args = {}, body = "this._context().beginPath();")
    1.48 -    void beginPath();
    1.49 +    public boolean isPointInPath(double x, double y);
    1.50  
    1.51 -    @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"}, body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
    1.52 -    void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    1.53 +    public void fill();
    1.54  
    1.55 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
    1.56 -    void clearRect(double x, double y, double width, double height);
    1.57 +    public void stroke();
    1.58  
    1.59 -    @JavaScriptBody(args = {}, body = "this._context().clip();")
    1.60 -    void clip();
    1.61 +    public void beginPath();
    1.62  
    1.63 -    @JavaScriptBody(args = {}, body = "this._context().closePath();")
    1.64 -    void closePath();
    1.65 +    public void closePath();
    1.66  
    1.67 -    @JavaScriptBody(args = {}, body = "this._context().fill();")
    1.68 -    void fill();
    1.69 +    public void clip();
    1.70  
    1.71 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
    1.72 -    void fillRect(double x, double y, double width, double height);
    1.73 +    public void moveTo(double x, double y);
    1.74  
    1.75 -    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
    1.76 -    void fillText(String text, double x, double y);
    1.77 +    public void lineTo(double x, double y);
    1.78  
    1.79 -    @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
    1.80 -    void fillText(String text, double x, double y, double maxWidth);
    1.81 +    public void quadraticCurveTo(double cpx, double cpy, double x, double y);
    1.82  
    1.83 -    @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
    1.84 -    String getFillStyle();
    1.85 +    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    1.86  
    1.87 -    @JavaScriptBody(args = {}, body = "return this._context().font;")
    1.88 -    String getFont();
    1.89 +    public void fillRect(double x, double y, double width, double height);
    1.90  
    1.91 -    @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
    1.92 -    double getGlobalAlpha();
    1.93 +    public void strokeRect(double x, double y, double width, double height);
    1.94  
    1.95 -    @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
    1.96 -    String getGlobalCompositeOperation();
    1.97 +    public void clearRect(double x, double y, double width, double height);
    1.98  
    1.99 -    @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
   1.100 -    String getLineCap();
   1.101 +    public void rect(double x, double y, double width, double height);
   1.102  
   1.103 -    @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
   1.104 -    String getLineJoin();
   1.105 +    public void save();
   1.106  
   1.107 -    @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
   1.108 -    double getLineWidth();
   1.109 +    public void restore();
   1.110  
   1.111 -    @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
   1.112 -    double getMiterLimit();
   1.113 +    public void rotate(double angle);
   1.114  
   1.115 -    @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
   1.116 -    double getShadowBlur();
   1.117 +    public void transform(double a, double b, double c, double d, double e, double f);
   1.118  
   1.119 -    @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
   1.120 -    String getShadowColor();
   1.121 +    public void setTransform(double a, double b, double c, double d, double e, double f);
   1.122  
   1.123 -    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
   1.124 -    double getShadowOffsetX();
   1.125 +    public void translate(double x, double y);
   1.126  
   1.127 -    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
   1.128 -    double getShadowOffsetY();
   1.129 +    public void scale(double x, double y);
   1.130  
   1.131 -    @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
   1.132 -    String getStrokeStyle();
   1.133 +    public void drawImage(Image image, double x, double y);
   1.134  
   1.135 -    @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
   1.136 -    String getTextAlign();
   1.137 +    public void drawImage(Image image, double x, double y, double width, double height);
   1.138  
   1.139 -    @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
   1.140 -    String getTextBaseline();
   1.141 +    public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
   1.142  
   1.143 -    @JavaScriptBody(args = {"x", "y"}, body = "return this._context().isPointInPath(x,y);")
   1.144 -    boolean isPointInPath(double x, double y);
   1.145 +    public void setFillStyle(String style);
   1.146  
   1.147 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
   1.148 -    void lineTo(double x, double y);
   1.149 +    public String getFillStyle();
   1.150  
   1.151 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
   1.152 -    void moveTo(double x, double y);
   1.153 +    public void setFillStyle(LinearGradient style);
   1.154  
   1.155 -    @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
   1.156 -    void quadraticCurveTo(double cpx, double cpy, double x, double y);
   1.157 +    public void setFillStyle(RadialGradient style);
   1.158  
   1.159 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
   1.160 -    void rect(double x, double y, double width, double height);
   1.161 +    public void setFillStyle(Pattern style);
   1.162  
   1.163 -    @JavaScriptBody(args = {}, body = "this._context().restore();")
   1.164 -    void restore();
   1.165 +    public void setStrokeStyle(String style);
   1.166  
   1.167 -    @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
   1.168 -    void rotate(double angle);
   1.169 +    public void setStrokeStyle(LinearGradient style);
   1.170  
   1.171 -    @JavaScriptBody(args = {}, body = "this._context().save();")
   1.172 -    void save();
   1.173 +    public void setStrokeStyle(RadialGradient style);
   1.174  
   1.175 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
   1.176 -    void scale(double x, double y);
   1.177 +    public void setStrokeStyle(Pattern style);
   1.178  
   1.179 -    @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
   1.180 -    void setFillStyle(String style);
   1.181 +    public void setShadowColor(String color);
   1.182  
   1.183 -    @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
   1.184 -    void setFont(String font);
   1.185 +    public void setShadowBlur(double blur);
   1.186  
   1.187 -    @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
   1.188 -    void setGlobalAlpha(double alpha);
   1.189 +    public void setShadowOffsetX(double x);
   1.190  
   1.191 -    @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
   1.192 -    void setGlobalCompositeOperation(String operation);
   1.193 +    public void setShadowOffsetY(double y);
   1.194  
   1.195 -    @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
   1.196 -    void setLineCap(String style);
   1.197 +    public String getStrokeStyle();
   1.198  
   1.199 -    @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
   1.200 -    void setLineJoin(String style);
   1.201 +    public String getShadowColor();
   1.202  
   1.203 -    @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
   1.204 -    void setLineWidth(double width);
   1.205 +    public double getShadowBlur();
   1.206  
   1.207 -    @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
   1.208 -    void setMiterLimit(double limit);
   1.209 +    public double getShadowOffsetX();
   1.210  
   1.211 -    @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
   1.212 -    void setShadowBlur(double blur);
   1.213 +    public double getShadowOffsetY();
   1.214  
   1.215 -    @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
   1.216 -    void setShadowColor(String color);
   1.217 +    public String getLineCap();
   1.218  
   1.219 -    @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
   1.220 -    void setShadowOffsetX(double x);
   1.221 +    public void setLineCap(String style);
   1.222  
   1.223 -    @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
   1.224 -    void setShadowOffsetY(double y);
   1.225 +    public String getLineJoin();
   1.226  
   1.227 -    @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
   1.228 -    void setStrokeStyle(String style);
   1.229 +    public void setLineJoin(String style);
   1.230  
   1.231 -    @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
   1.232 -    void setTextAlign(String textAlign);
   1.233 +    public double getLineWidth();
   1.234  
   1.235 -    @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
   1.236 -    void setTextBaseline(String textbaseline);
   1.237 +    public void setLineWidth(double width);
   1.238  
   1.239 -    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
   1.240 -    void setTransform(double a, double b, double c, double d, double e, double f);
   1.241 +    public double getMiterLimit();
   1.242  
   1.243 -    @JavaScriptBody(args = {}, body = "this._context().stroke();")
   1.244 -    void stroke();
   1.245 +    public void setMiterLimit(double limit);
   1.246  
   1.247 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
   1.248 -    void strokeRect(double x, double y, double width, double height);
   1.249 +    public String getFont();
   1.250  
   1.251 -    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
   1.252 -    void strokeText(String text, double x, double y);
   1.253 +    public void setFont(String font);
   1.254  
   1.255 -    @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
   1.256 -    void strokeText(String text, double x, double y, double maxWidth);
   1.257 +    public String getTextAlign();
   1.258  
   1.259 -    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
   1.260 -    void transform(double a, double b, double c, double d, double e, double f);
   1.261 +    public void setTextAlign(String textAlign);
   1.262  
   1.263 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
   1.264 -    void translate(double x, double y);
   1.265 -    
   1.266 +    public String getTextBaseline();
   1.267 +
   1.268 +    public void setTextBaseline(String textbaseline);
   1.269 +
   1.270 +    public void fillText(String text, double x, double y);
   1.271 +
   1.272 +    public void fillText(String text, double x, double y, double maxWidth);
   1.273 +
   1.274 +    public TextMetrics measureText(String text);
   1.275 +
   1.276 +    public void strokeText(String text, double x, double y);
   1.277 +
   1.278 +    public void strokeText(String text, double x, double y, double maxWidth);
   1.279 +
   1.280 +    public ImageData createImageData(double x, double y);
   1.281 +
   1.282 +    public ImageData createImageData(ImageData imageData);
   1.283 +
   1.284 +    public ImageData getImageData(double x, double y, double width, double height);
   1.285 +
   1.286 +    public void putImageData(ImageData imageData, double x, double y);
   1.287 +
   1.288 +    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   1.289 +
   1.290 +    public void setGlobalAlpha(double alpha);
   1.291 +
   1.292 +    public double getGlobalAlpha();
   1.293 +
   1.294 +    public void setGlobalCompositeOperation(String operation);
   1.295 +
   1.296 +    public String getGlobalCompositeOperation();
   1.297 +
   1.298 +    public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1);
   1.299 +
   1.300 +    public Pattern createPattern(Image image, String repeat);
   1.301 +
   1.302 +    public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
   1.303  }