temporarily disabled ImageData before we found a nice solution. Maybe introduce PixelReader PixelWriter for GraphicsContext. canvas
authorAnton Epple <toni.epple@eppleton.de>
Thu, 23 May 2013 10:02:14 +0200
branchcanvas
changeset 11340a2190f2a210
parent 1133 0ae830f00e0c
child 1135 836bc1845c65
temporarily disabled ImageData before we found a nice solution. Maybe introduce PixelReader PixelWriter for GraphicsContext.
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Canvas.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/GraphicsContext.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Image.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageData.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageDataWrapper.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageWrapper.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradient.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradientWrapper.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Pattern.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/PatternWrapper.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradient.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradientWrapper.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/TextMetrics.java
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Canvas.java	Thu May 23 09:56:49 2013 +0200
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Canvas.java	Thu May 23 10:02:14 2013 +0200
     1.3 @@ -17,8 +17,7 @@
     1.4   */
     1.5  package org.apidesign.bck2brwsr.htmlpage.api;
     1.6  
     1.7 -import net.java.html.canvas.ICanvas;
     1.8 -import net.java.html.canvas.IGraphicsContext;
     1.9 +import net.java.html.canvas.GraphicsContext;
    1.10  import org.apidesign.bck2brwsr.core.JavaScriptBody;
    1.11  import static org.apidesign.bck2brwsr.htmlpage.api.Element.getAttribute;
    1.12  
    1.13 @@ -26,29 +25,25 @@
    1.14   *
    1.15   * @author Anton Epple <toni.epple@eppleton.de>
    1.16   */
    1.17 -public class Canvas extends Element implements ICanvas{
    1.18 +public class Canvas extends Element {
    1.19  
    1.20      public Canvas(String id) {
    1.21          super(id);
    1.22      }
    1.23  
    1.24 -    @Override
    1.25      public void setHeight(int height) {
    1.26          setAttribute(this, "height", height);
    1.27      }
    1.28  
    1.29 -    @Override
    1.30      public int getHeight() {
    1.31         Object ret =  getAttribute(this, "height");
    1.32         return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
    1.33      }
    1.34      
    1.35 -    @Override
    1.36      public void setWidth(int width) {
    1.37          setAttribute(this, "width", width);
    1.38      }
    1.39  
    1.40 -    @Override
    1.41      public int getWidth() {
    1.42         Object ret =  getAttribute(this, "width");
    1.43         return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
    1.44 @@ -60,8 +55,8 @@
    1.45              + "return e.getContext('2d');\n")
    1.46      private native static Object getContextImpl(Canvas el);
    1.47  
    1.48 -    public IGraphicsContext getContext() {
    1.49 -        return new GraphicsContext(getContextImpl(this));
    1.50 +    public GraphicsContext getContext() {
    1.51 +        return new GraphicsContext(new HTML5GraphicsEnvironment(getContextImpl(this), this));
    1.52      }
    1.53  
    1.54      @Override
     2.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/GraphicsContext.java	Thu May 23 09:56:49 2013 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,425 +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 org.apidesign.bck2brwsr.htmlpage.api;
    2.22 -
    2.23 -
    2.24 -import net.java.html.canvas.IGraphicsContext;
    2.25 -import net.java.html.canvas.IImage;
    2.26 -import net.java.html.canvas.IImageData;
    2.27 -import net.java.html.canvas.ILinearGradient;
    2.28 -import net.java.html.canvas.IPattern;
    2.29 -import net.java.html.canvas.IRadialGradient;
    2.30 -import net.java.html.canvas.ITextMetrics;
    2.31 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    2.32 -
    2.33 -
    2.34 -/**
    2.35 - *
    2.36 - * @author Anton Epple <toni.epple@eppleton.de>
    2.37 - */
    2.38 -public class GraphicsContext implements IGraphicsContext {
    2.39 -
    2.40 -    Object context;
    2.41 -
    2.42 -    GraphicsContext(Object contextImpl) {
    2.43 -        this.context = contextImpl;
    2.44 -    }
    2.45 -
    2.46 -    @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"},
    2.47 -            body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
    2.48 -    @Override
    2.49 -    public native void arc(double centerX,
    2.50 -            double centerY,
    2.51 -            double startAngle,
    2.52 -            double radius,
    2.53 -            double endAngle,
    2.54 -            boolean ccw);
    2.55 -
    2.56 -    @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"},
    2.57 -            body = "this._context().arcTo(x1,y1,x2,y2,r);")
    2.58 -    @Override
    2.59 -    public native void arcTo(double x1,
    2.60 -            double y1,
    2.61 -            double x2,
    2.62 -            double y2,
    2.63 -            double r);
    2.64 -
    2.65 -    @JavaScriptBody(args = {"x", "y"},
    2.66 -            body = "return this._context().isPointInPath(x,y);")
    2.67 -    @Override
    2.68 -    public native boolean isPointInPath(double x, double y);
    2.69 -
    2.70 -    @JavaScriptBody(args = {}, body = "this._context().fill();")
    2.71 -    @Override
    2.72 -    public native void fill();
    2.73 -
    2.74 -    @JavaScriptBody(args = {}, body = "this._context().stroke();")
    2.75 -    @Override
    2.76 -    public native void stroke();
    2.77 -
    2.78 -    @JavaScriptBody(args = {}, body = "this._context().beginPath();")
    2.79 -    @Override
    2.80 -    public native void beginPath();
    2.81 -
    2.82 -    @JavaScriptBody(args = {}, body = "this._context().closePath();")
    2.83 -    @Override
    2.84 -    public native void closePath();
    2.85 -
    2.86 -    @JavaScriptBody(args = {}, body = "this._context().clip();")
    2.87 -    @Override
    2.88 -    public native void clip();
    2.89 -
    2.90 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
    2.91 -    @Override
    2.92 -    public native void moveTo(double x, double y);
    2.93 -
    2.94 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
    2.95 -    @Override
    2.96 -    public native void lineTo(double x, double y);
    2.97 -
    2.98 -    @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
    2.99 -    @Override
   2.100 -    public native void quadraticCurveTo(double cpx, double cpy, double x, double y);
   2.101 -
   2.102 -    @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"},
   2.103 -            body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
   2.104 -    @Override
   2.105 -    public native void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
   2.106 -
   2.107 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
   2.108 -    @Override
   2.109 -    public native void fillRect(double x, double y, double width, double height);
   2.110 -
   2.111 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
   2.112 -    @Override
   2.113 -    public native void strokeRect(double x, double y, double width, double height);
   2.114 -
   2.115 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
   2.116 -    @Override
   2.117 -    public native void clearRect(double x, double y, double width, double height);
   2.118 -
   2.119 -    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
   2.120 -    @Override
   2.121 -    public native void rect(double x, double y, double width, double height);
   2.122 -
   2.123 -    @JavaScriptBody(args = {}, body = "this._context().save();")
   2.124 -    @Override
   2.125 -    public native void save();
   2.126 -
   2.127 -    @JavaScriptBody(args = {}, body = "this._context().restore();")
   2.128 -    @Override
   2.129 -    public native void restore();
   2.130 -
   2.131 -    @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
   2.132 -    @Override
   2.133 -    public native void rotate(double angle);
   2.134 -
   2.135 -    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
   2.136 -    @Override
   2.137 -    public native void transform(double a, double b, double c, double d, double e, double f);
   2.138 -
   2.139 -    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
   2.140 -    @Override
   2.141 -    public native void setTransform(double a, double b, double c, double d, double e, double f);
   2.142 -
   2.143 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
   2.144 -    @Override
   2.145 -    public native void translate(double x, double y);
   2.146 -
   2.147 -    @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
   2.148 -    @Override
   2.149 -    public native void scale(double x, double y);
   2.150 -
   2.151 -    @Override
   2.152 -    public void drawImage(IImage image, double x, double y) {
   2.153 -        drawImageImpl(context, Element.getElementById((Image) image), x, y);
   2.154 -    }
   2.155 -
   2.156 -    @Override
   2.157 -    public void drawImage(IImage image, double x, double y, double width, double height) {
   2.158 -        drawImageImpl(context, Element.getElementById((Image) image), x, y, width, height);
   2.159 -    }
   2.160 -
   2.161 -    @Override
   2.162 -    public void drawImage(IImage image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height) {
   2.163 -        drawImageImpl(context, Element.getElementById((Image) image), sx, sy, sWidth, sHeight, x, y, width, height);
   2.164 -    }
   2.165 -
   2.166 -    @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height);")
   2.167 -    private native static void drawImageImpl(Object ctx, Object img, double x, double y, double width, double height);
   2.168 -
   2.169 -    @JavaScriptBody(args = {"ctx", "img", "sx", "sy", "swidth", "sheight", "x", "y", "width", "height"}, body = "ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);")
   2.170 -    private native static void drawImageImpl(Object ctx, Object img, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
   2.171 -
   2.172 -    @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "ctx.drawImage(img,x,y);")
   2.173 -    private native static void drawImageImpl(Object ctx, Object img, double x, double y);
   2.174 -
   2.175 -    @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
   2.176 -    @Override
   2.177 -    public native void setFillStyle(String style);
   2.178 -
   2.179 -    @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
   2.180 -    @Override
   2.181 -    public native String getFillStyle();
   2.182 -
   2.183 -    @Override
   2.184 -    public void setFillStyle(ILinearGradient style) {
   2.185 -        setFillStyleImpl(context, ((LinearGradient) style).object());
   2.186 -    }
   2.187 -
   2.188 -    @Override
   2.189 -    public void setFillStyle(IRadialGradient style) {
   2.190 -        setFillStyleImpl(context, ((RadialGradient) style).object());
   2.191 -    }
   2.192 -
   2.193 -    @Override
   2.194 -    public void setFillStyle(IPattern style) {
   2.195 -        setFillStyleImpl(context, ((Pattern) style).object());
   2.196 -    }
   2.197 -
   2.198 -    @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
   2.199 -    private native void setFillStyleImpl(Object context, Object obj);
   2.200 -
   2.201 -    @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
   2.202 -    @Override
   2.203 -    public native void setStrokeStyle(String style);
   2.204 -
   2.205 -    @Override
   2.206 -    public void setStrokeStyle(ILinearGradient style) {
   2.207 -        setStrokeStyleImpl(context, ((LinearGradient) style).object());
   2.208 -    }
   2.209 -
   2.210 -    @Override
   2.211 -    public void setStrokeStyle(IRadialGradient style) {
   2.212 -        setStrokeStyleImpl(context, ((RadialGradient) style).object());
   2.213 -    }
   2.214 -
   2.215 -    @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style;")
   2.216 -    @Override
   2.217 -    public void setStrokeStyle(IPattern style) {
   2.218 -        setStrokeStyleImpl(context, ((LinearGradient) style).object());
   2.219 -    }
   2.220 -
   2.221 -    @JavaScriptBody(args = {"context", "obj"}, body = "context.strokeStyle=obj;")
   2.222 -    private native void setStrokeStyleImpl(Object context, Object obj);
   2.223 -
   2.224 -    @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
   2.225 -    @Override
   2.226 -    public native void setShadowColor(String color);
   2.227 -
   2.228 -    @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
   2.229 -    @Override
   2.230 -    public native void setShadowBlur(double blur);
   2.231 -
   2.232 -    @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
   2.233 -    @Override
   2.234 -    public native void setShadowOffsetX(double x);
   2.235 -
   2.236 -    @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
   2.237 -    @Override
   2.238 -    public native void setShadowOffsetY(double y);
   2.239 -
   2.240 -    @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
   2.241 -    @Override
   2.242 -    public native String getStrokeStyle();
   2.243 -
   2.244 -    @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
   2.245 -    @Override
   2.246 -    public native String getShadowColor();
   2.247 -
   2.248 -    @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
   2.249 -    @Override
   2.250 -    public native double getShadowBlur();
   2.251 -
   2.252 -    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
   2.253 -    @Override
   2.254 -    public native double getShadowOffsetX();
   2.255 -
   2.256 -    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
   2.257 -    @Override
   2.258 -    public native double getShadowOffsetY();
   2.259 -
   2.260 -    @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
   2.261 -    @Override
   2.262 -    public native String getLineCap();
   2.263 -
   2.264 -    @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
   2.265 -    @Override
   2.266 -    public native void setLineCap(String style);
   2.267 -
   2.268 -    @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
   2.269 -    @Override
   2.270 -    public native String getLineJoin();
   2.271 -
   2.272 -    @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
   2.273 -    @Override
   2.274 -    public native void setLineJoin(String style);
   2.275 -
   2.276 -    @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
   2.277 -    @Override
   2.278 -    public native double getLineWidth();
   2.279 -
   2.280 -    @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
   2.281 -    @Override
   2.282 -    public native void setLineWidth(double width);
   2.283 -
   2.284 -    @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
   2.285 -    @Override
   2.286 -    public native double getMiterLimit();
   2.287 -
   2.288 -    @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
   2.289 -    @Override
   2.290 -    public native void setMiterLimit(double limit);
   2.291 -
   2.292 -    @JavaScriptBody(args = {}, body = "return this._context().font;")
   2.293 -    @Override
   2.294 -    public native String getFont();
   2.295 -
   2.296 -    @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
   2.297 -    @Override
   2.298 -    public native void setFont(String font);
   2.299 -
   2.300 -    @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
   2.301 -    @Override
   2.302 -    public native String getTextAlign();
   2.303 -
   2.304 -    @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
   2.305 -    @Override
   2.306 -    public native void setTextAlign(String textAlign);
   2.307 -
   2.308 -    @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
   2.309 -    @Override
   2.310 -    public native String getTextBaseline();
   2.311 -
   2.312 -    @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
   2.313 -    @Override
   2.314 -    public native void setTextBaseline(String textbaseline);
   2.315 -
   2.316 -    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
   2.317 -    @Override
   2.318 -    public native void fillText(String text, double x, double y);
   2.319 -
   2.320 -    @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
   2.321 -    @Override
   2.322 -    public void fillText(String text, double x, double y, double maxWidth) {
   2.323 -    }
   2.324 -
   2.325 -    @Override
   2.326 -    public ITextMetrics measureText(String text) {
   2.327 -        return new TextMetrics(measureTextImpl(text));
   2.328 -    }
   2.329 -
   2.330 -    @JavaScriptBody(args = {"text"},
   2.331 -            body = "return this._context().measureText(text);")
   2.332 -    private native Object measureTextImpl(String text);
   2.333 -
   2.334 -    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
   2.335 -    @Override
   2.336 -    public native void strokeText(String text, double x, double y);
   2.337 -
   2.338 -    @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
   2.339 -    @Override
   2.340 -    public native void strokeText(String text, double x, double y, double maxWidth);
   2.341 -
   2.342 -    @Override
   2.343 -    public IImageData createImageData(double x, double y) {
   2.344 -        return new ImageData(createImageDataImpl(x, y));
   2.345 -    }
   2.346 -
   2.347 -    @JavaScriptBody(args = {"x", "y"},
   2.348 -            body = "return this._context().createImageData(x,y);")
   2.349 -    private native Object createImageDataImpl(double x, double y);
   2.350 -
   2.351 -    @Override
   2.352 -    public IImageData createImageData(IImageData imageData) {
   2.353 -        return new ImageData(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
   2.354 -    }
   2.355 -
   2.356 -    @Override
   2.357 -    public IImageData getImageData(double x, double y, double width, double height) {
   2.358 -        return new ImageData(getImageDataImpl(x, y, width, height));
   2.359 -    }
   2.360 -
   2.361 -    @JavaScriptBody(args = {"x", "y", "width", "height"},
   2.362 -            body = "return this._context().getImageData(x,y,width,height);")
   2.363 -    private native Object getImageDataImpl(double x, double y, double width, double height);
   2.364 -
   2.365 -    @Override
   2.366 -    public void putImageData(IImageData imageData, double x, double y) {
   2.367 -        putImageDataImpl(((ImageData) imageData).object(), x, y);
   2.368 -    }
   2.369 -
   2.370 -    @JavaScriptBody(args = {"imageData", "x", "y"},
   2.371 -            body = "this._context().putImageData(imageData,x,y);")
   2.372 -    private native void putImageDataImpl(Object imageData, double x, double y);
   2.373 -
   2.374 -    @Override
   2.375 -    public void putImageData(IImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
   2.376 -        putImageDataImpl(((ImageData) imageData).object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
   2.377 -    }
   2.378 -
   2.379 -    @JavaScriptBody(args = {"imageData", "x", "y", "dirtyx", "dirtyy", "dirtywidth", "dirtyheight"},
   2.380 -            body = "this._context().putImageData(imageData,x,y, dirtyx, dirtyy, dirtywidth,dirtyheight);")
   2.381 -    private native void putImageDataImpl(Object imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   2.382 -
   2.383 -    @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
   2.384 -    @Override
   2.385 -    public native void setGlobalAlpha(double alpha);
   2.386 -
   2.387 -    @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
   2.388 -    @Override
   2.389 -    public native double getGlobalAlpha();
   2.390 -
   2.391 -    @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
   2.392 -    @Override
   2.393 -    public native void setGlobalCompositeOperation(String operation);
   2.394 -
   2.395 -    @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
   2.396 -    @Override
   2.397 -    public native String getGlobalCompositeOperation();
   2.398 -
   2.399 -    @Override
   2.400 -    public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
   2.401 -        return new LinearGradient(createLinearGradientImpl(context, x0, y0, x1, y1));
   2.402 -    }
   2.403 -
   2.404 -    @JavaScriptBody(args = {"context", "x0", "y0", "x1", "y1"}, body = "return context.createLinearGradient(x0,y0,x1,y1);")
   2.405 -    private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
   2.406 -
   2.407 -    @Override
   2.408 -    public IPattern createPattern(IImage image, String repeat) {
   2.409 -        return new Pattern(createPatternImpl(context, image, repeat));
   2.410 -    }
   2.411 -
   2.412 -    @JavaScriptBody(args = {"context", "image", "repeat"}, body = "return context.createPattern(image, repeat);")
   2.413 -    private static native Object createPatternImpl(Object context, IImage image, String repeat);
   2.414 -
   2.415 -    @Override
   2.416 -    public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
   2.417 -        return new RadialGradient(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
   2.418 -    }
   2.419 -
   2.420 -    @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
   2.421 -    private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
   2.422 -
   2.423 -    @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
   2.424 -    @Override
   2.425 -    public IImage getImageForPath(String path) {
   2.426 -        throw new UnsupportedOperationException("getImageForPath is not yet supported");
   2.427 -    }
   2.428 -}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java	Thu May 23 10:02:14 2013 +0200
     3.3 @@ -0,0 +1,464 @@
     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 org.apidesign.bck2brwsr.htmlpage.api;
    3.22 +
    3.23 +import java.awt.Dimension;
    3.24 +import java.util.HashMap;
    3.25 +import java.util.Set;
    3.26 +import net.java.html.canvas.GraphicsEnvironment;
    3.27 +import net.java.html.canvas.Image;
    3.28 +import net.java.html.canvas.LinearGradient;
    3.29 +import net.java.html.canvas.Pattern;
    3.30 +import net.java.html.canvas.RadialGradient;
    3.31 +import net.java.html.canvas.Style;
    3.32 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
    3.33 +
    3.34 +/**
    3.35 + *
    3.36 + * @author Anton Epple <toni.epple@eppleton.de>
    3.37 + */
    3.38 +public class HTML5GraphicsEnvironment implements GraphicsEnvironment {
    3.39 +
    3.40 +    Object context;
    3.41 +    Canvas canvas;
    3.42 +    HTML5GraphicsEnvironment(Object contextImpl, Canvas canvas) {
    3.43 +        this.context = contextImpl;
    3.44 +        this.canvas = canvas;
    3.45 +    }
    3.46 +
    3.47 +    @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"},
    3.48 +            body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
    3.49 +    @Override
    3.50 +    public native void arc(double centerX,
    3.51 +            double centerY,
    3.52 +            double startAngle,
    3.53 +            double radius,
    3.54 +            double endAngle,
    3.55 +            boolean ccw);
    3.56 +
    3.57 +    @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"},
    3.58 +            body = "this._context().arcTo(x1,y1,x2,y2,r);")
    3.59 +    @Override
    3.60 +    public native void arcTo(double x1,
    3.61 +            double y1,
    3.62 +            double x2,
    3.63 +            double y2,
    3.64 +            double r);
    3.65 +
    3.66 +    @JavaScriptBody(args = {"x", "y"},
    3.67 +            body = "return this._context().isPointInPath(x,y);")
    3.68 +    @Override
    3.69 +    public native boolean isPointInPath(double x, double y);
    3.70 +
    3.71 +    @JavaScriptBody(args = {}, body = "this._context().fill();")
    3.72 +    @Override
    3.73 +    public native void fill();
    3.74 +
    3.75 +    @JavaScriptBody(args = {}, body = "this._context().stroke();")
    3.76 +    @Override
    3.77 +    public native void stroke();
    3.78 +
    3.79 +    @JavaScriptBody(args = {}, body = "this._context().beginPath();")
    3.80 +    @Override
    3.81 +    public native void beginPath();
    3.82 +
    3.83 +    @JavaScriptBody(args = {}, body = "this._context().closePath();")
    3.84 +    @Override
    3.85 +    public native void closePath();
    3.86 +
    3.87 +    @JavaScriptBody(args = {}, body = "this._context().clip();")
    3.88 +    @Override
    3.89 +    public native void clip();
    3.90 +
    3.91 +    @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
    3.92 +    @Override
    3.93 +    public native void moveTo(double x, double y);
    3.94 +
    3.95 +    @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
    3.96 +    @Override
    3.97 +    public native void lineTo(double x, double y);
    3.98 +
    3.99 +    @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
   3.100 +    @Override
   3.101 +    public native void quadraticCurveTo(double cpx, double cpy, double x, double y);
   3.102 +
   3.103 +    @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"},
   3.104 +            body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
   3.105 +    @Override
   3.106 +    public native void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
   3.107 +
   3.108 +    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
   3.109 +    @Override
   3.110 +    public native void fillRect(double x, double y, double width, double height);
   3.111 +
   3.112 +    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
   3.113 +    @Override
   3.114 +    public native void strokeRect(double x, double y, double width, double height);
   3.115 +
   3.116 +    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
   3.117 +    @Override
   3.118 +    public native void clearRect(double x, double y, double width, double height);
   3.119 +
   3.120 +    @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
   3.121 +    @Override
   3.122 +    public native void rect(double x, double y, double width, double height);
   3.123 +
   3.124 +    @JavaScriptBody(args = {}, body = "this._context().save();")
   3.125 +    @Override
   3.126 +    public native void save();
   3.127 +
   3.128 +    @JavaScriptBody(args = {}, body = "this._context().restore();")
   3.129 +    @Override
   3.130 +    public native void restore();
   3.131 +
   3.132 +    @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
   3.133 +    @Override
   3.134 +    public native void rotate(double angle);
   3.135 +
   3.136 +    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
   3.137 +    @Override
   3.138 +    public native void transform(double a, double b, double c, double d, double e, double f);
   3.139 +
   3.140 +    @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
   3.141 +    @Override
   3.142 +    public native void setTransform(double a, double b, double c, double d, double e, double f);
   3.143 +
   3.144 +    @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
   3.145 +    @Override
   3.146 +    public native void translate(double x, double y);
   3.147 +
   3.148 +    @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
   3.149 +    @Override
   3.150 +    public native void scale(double x, double y);
   3.151 +
   3.152 +    @Override
   3.153 +    public void drawImage(Image image, double x, double y) {
   3.154 +        drawImageImpl(context, Element.getElementById((ImageWrapper) image), x, y);
   3.155 +    }
   3.156 +
   3.157 +    @Override
   3.158 +    public void drawImage(Image image, double x, double y, double width, double height) {
   3.159 +        drawImageImpl(context, Element.getElementById((ImageWrapper) image), x, y, width, height);
   3.160 +    }
   3.161 +
   3.162 +    @Override
   3.163 +    public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height) {
   3.164 +        drawImageImpl(context, Element.getElementById((ImageWrapper) image), sx, sy, sWidth, sHeight, x, y, width, height);
   3.165 +    }
   3.166 +
   3.167 +    @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height);")
   3.168 +    private native static void drawImageImpl(Object ctx, Object img, double x, double y, double width, double height);
   3.169 +
   3.170 +    @JavaScriptBody(args = {"ctx", "img", "sx", "sy", "swidth", "sheight", "x", "y", "width", "height"}, body = "ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);")
   3.171 +    private native static void drawImageImpl(Object ctx, Object img, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
   3.172 +
   3.173 +    @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "ctx.drawImage(img,x,y);")
   3.174 +    private native static void drawImageImpl(Object ctx, Object img, double x, double y);
   3.175 +
   3.176 +    @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
   3.177 +    @Override
   3.178 +    public native void setFillStyle(String style);
   3.179 +
   3.180 +    @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
   3.181 +    @Override
   3.182 +    public native String getFillStyle();
   3.183 +
   3.184 +    @Override
   3.185 +    public void setFillStyle(Style style) {
   3.186 +        setFillStyleImpl(context, createFillStyle(style));
   3.187 +    }
   3.188 +
   3.189 +    private Object createFillStyle(Style style) {
   3.190 +        if (style instanceof RadialGradient) {
   3.191 +            RadialGradientWrapper gradient = createRadialGradientWrapper(
   3.192 +                    ((RadialGradient) style).getX0(),
   3.193 +                    ((RadialGradient) style).getY0(),
   3.194 +                    ((RadialGradient) style).getR0(),
   3.195 +                    ((RadialGradient) style).getX1(),
   3.196 +                    ((RadialGradient) style).getY1(),
   3.197 +                    ((RadialGradient) style).getR1());
   3.198 +            HashMap<Double, String> stops = ((LinearGradient) style).getStops();
   3.199 +            Set<Double> keySet = stops.keySet();
   3.200 +            for (Double double1 : keySet) {
   3.201 +                addColorStopImpl(style, double1, stops.get(double1));
   3.202 +            }
   3.203 +            return gradient;
   3.204 +
   3.205 +
   3.206 +        } else if (style instanceof LinearGradient) {
   3.207 +            LinearGradientWrapper gradient = createLinearGradientWrapper(
   3.208 +                    ((LinearGradient) style).getX0(),
   3.209 +                    ((LinearGradient) style).getY0(),
   3.210 +                    ((LinearGradient) style).getX1(),
   3.211 +                    ((LinearGradient) style).getY1());
   3.212 +            HashMap<Double, String> stops = ((LinearGradient) style).getStops();
   3.213 +            Set<Double> keySet = stops.keySet();
   3.214 +            for (Double double1 : keySet) {
   3.215 +                addColorStopImpl(style, double1, stops.get(double1));
   3.216 +            }
   3.217 +            return gradient;
   3.218 +        } else if (style instanceof Pattern) {
   3.219 +            return createPatternWrapper(((Pattern) style).getImageData(), ((Pattern) style).getRepeat());
   3.220 +        }
   3.221 +        return null;
   3.222 +    }
   3.223 +
   3.224 +
   3.225 +    @JavaScriptBody(args = {"gradient", "position", "color"}, body =
   3.226 +            "gradient.addColorStop(position,color)")
   3.227 +    private static native void addColorStopImpl(Object gradient, double position, String color);
   3.228 +
   3.229 +    @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
   3.230 +    private native void setFillStyleImpl(Object context, Object obj);
   3.231 +
   3.232 +    @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
   3.233 +    @Override
   3.234 +    public native void setStrokeStyle(String style);
   3.235 +
   3.236 +    @Override
   3.237 +    public void setStrokeStyle(Style style) {
   3.238 +        setStrokeStyleImpl(context, createFillStyle(style));
   3.239 +    }
   3.240 +
   3.241 +    @JavaScriptBody(args = {"context", "obj"}, body = "context.strokeStyle=obj;")
   3.242 +    private native void setStrokeStyleImpl(Object context, Object obj);
   3.243 +
   3.244 +    @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
   3.245 +    @Override
   3.246 +    public native void setShadowColor(String color);
   3.247 +
   3.248 +    @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
   3.249 +    @Override
   3.250 +    public native void setShadowBlur(double blur);
   3.251 +
   3.252 +    @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
   3.253 +    @Override
   3.254 +    public native void setShadowOffsetX(double x);
   3.255 +
   3.256 +    @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
   3.257 +    @Override
   3.258 +    public native void setShadowOffsetY(double y);
   3.259 +
   3.260 +    @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
   3.261 +    @Override
   3.262 +    public native String getStrokeStyle();
   3.263 +
   3.264 +    @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
   3.265 +    @Override
   3.266 +    public native String getShadowColor();
   3.267 +
   3.268 +    @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
   3.269 +    @Override
   3.270 +    public native double getShadowBlur();
   3.271 +
   3.272 +    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
   3.273 +    @Override
   3.274 +    public native double getShadowOffsetX();
   3.275 +
   3.276 +    @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
   3.277 +    @Override
   3.278 +    public native double getShadowOffsetY();
   3.279 +
   3.280 +    @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
   3.281 +    @Override
   3.282 +    public native String getLineCap();
   3.283 +
   3.284 +    @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
   3.285 +    @Override
   3.286 +    public native void setLineCap(String style);
   3.287 +
   3.288 +    @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
   3.289 +    @Override
   3.290 +    public native String getLineJoin();
   3.291 +
   3.292 +    @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
   3.293 +    @Override
   3.294 +    public native void setLineJoin(String style);
   3.295 +
   3.296 +    @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
   3.297 +    @Override
   3.298 +    public native double getLineWidth();
   3.299 +
   3.300 +    @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
   3.301 +    @Override
   3.302 +    public native void setLineWidth(double width);
   3.303 +
   3.304 +    @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
   3.305 +    @Override
   3.306 +    public native double getMiterLimit();
   3.307 +
   3.308 +    @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
   3.309 +    @Override
   3.310 +    public native void setMiterLimit(double limit);
   3.311 +
   3.312 +    @JavaScriptBody(args = {}, body = "return this._context().font;")
   3.313 +    @Override
   3.314 +    public native String getFont();
   3.315 +
   3.316 +    @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
   3.317 +    @Override
   3.318 +    public native void setFont(String font);
   3.319 +
   3.320 +    @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
   3.321 +    @Override
   3.322 +    public native String getTextAlign();
   3.323 +
   3.324 +    @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
   3.325 +    @Override
   3.326 +    public native void setTextAlign(String textAlign);
   3.327 +
   3.328 +    @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
   3.329 +    @Override
   3.330 +    public native String getTextBaseline();
   3.331 +
   3.332 +    @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
   3.333 +    @Override
   3.334 +    public native void setTextBaseline(String textbaseline);
   3.335 +
   3.336 +    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
   3.337 +    @Override
   3.338 +    public native void fillText(String text, double x, double y);
   3.339 +
   3.340 +    @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
   3.341 +    @Override
   3.342 +    public void fillText(String text, double x, double y, double maxWidth) {
   3.343 +    }
   3.344 +
   3.345 +    @Override
   3.346 +    public Dimension measureText(String text) {
   3.347 +        TextMetrics textMetrics = new TextMetrics(measureTextImpl(text));
   3.348 +        return new Dimension((int) textMetrics.getWidth(), (int) textMetrics.getHeight());
   3.349 +    }
   3.350 +
   3.351 +    @JavaScriptBody(args = {"text"},
   3.352 +            body = "return this._context().measureText(text);")
   3.353 +    private native Object measureTextImpl(String text);
   3.354 +
   3.355 +    @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
   3.356 +    @Override
   3.357 +    public native void strokeText(String text, double x, double y);
   3.358 +
   3.359 +    @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
   3.360 +    @Override
   3.361 +    public native void strokeText(String text, double x, double y, double maxWidth);
   3.362 +
   3.363 +//    @Override
   3.364 +//    public Image createImageData(double x, double y) {
   3.365 +//        return new ImageDataWrapper(createImageDataImpl(x, y));
   3.366 +//    }
   3.367 +//
   3.368 +//    @JavaScriptBody(args = {"x", "y"},
   3.369 +//            body = "return this._context().createImageData(x,y);")
   3.370 +//    private native Object createImageDataImpl(double x, double y);
   3.371 +//
   3.372 +//    @Override
   3.373 +//    public Image createImageData(Image imageData) {
   3.374 +//        return new ImageDataWrapper(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
   3.375 +//    }
   3.376 +//
   3.377 +//    @Override
   3.378 +//    public Image getImageData(double x, double y, double width, double height) {
   3.379 +//        return new ImageDataWrapper(getImageDataImpl(x, y, width, height));
   3.380 +//    }
   3.381 +
   3.382 +    @JavaScriptBody(args = {"x", "y", "width", "height"},
   3.383 +            body = "return this._context().getImageData(x,y,width,height);")
   3.384 +    private native Object getImageDataImpl(double x, double y, double width, double height);
   3.385 +
   3.386 +//    @Override
   3.387 +//    public void putImageData(Image imageData, double x, double y) {
   3.388 +//        putImageDataImpl(((ImageDataWrapper) imageData).object(), x, y);
   3.389 +//    }
   3.390 +//
   3.391 +//    @JavaScriptBody(args = {"imageData", "x", "y"},
   3.392 +//            body = "this._context().putImageData(imageData,x,y);")
   3.393 +//    private native void putImageDataImpl(Object imageData, double x, double y);
   3.394 +//
   3.395 +//    @Override
   3.396 +//    public void putImageData(Image imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
   3.397 +//        putImageDataImpl(((ImageDataWrapper) imageData).object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
   3.398 +//    }
   3.399 +
   3.400 +    @JavaScriptBody(args = {"imageData", "x", "y", "dirtyx", "dirtyy", "dirtywidth", "dirtyheight"},
   3.401 +            body = "this._context().putImageData(imageData,x,y, dirtyx, dirtyy, dirtywidth,dirtyheight);")
   3.402 +    private native void putImageDataImpl(Object imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   3.403 +
   3.404 +    @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
   3.405 +    @Override
   3.406 +    public native void setGlobalAlpha(double alpha);
   3.407 +
   3.408 +    @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
   3.409 +    @Override
   3.410 +    public native double getGlobalAlpha();
   3.411 +
   3.412 +    @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
   3.413 +    @Override
   3.414 +    public native void setGlobalCompositeOperation(String operation);
   3.415 +
   3.416 +    @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
   3.417 +    @Override
   3.418 +    public native String getGlobalCompositeOperation();
   3.419 +
   3.420 +    public LinearGradientWrapper createLinearGradientWrapper(double x0, double y0, double x1, double y1) {
   3.421 +        return new LinearGradientWrapper(createLinearGradientImpl(context, x0, y0, x1, y1));
   3.422 +    }
   3.423 +
   3.424 +    @JavaScriptBody(args = {"context", "x0", "y0", "x1", "y1"}, body = "return context.createLinearGradient(x0,y0,x1,y1);")
   3.425 +    private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
   3.426 +
   3.427 +    public PatternWrapper createPatternWrapper(Image image, String repeat) {
   3.428 +        return new PatternWrapper(createPatternImpl(context, image, repeat));
   3.429 +    }
   3.430 +
   3.431 +    @JavaScriptBody(args = {"context", "image", "repeat"}, body = "return context.createPattern(image, repeat);")
   3.432 +    private static native Object createPatternImpl(Object context, Image image, String repeat);
   3.433 +
   3.434 +    public RadialGradientWrapper createRadialGradientWrapper(double x0, double y0, double r0, double x1, double y1, double r1) {
   3.435 +        return new RadialGradientWrapper(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
   3.436 +    }
   3.437 +
   3.438 +    @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
   3.439 +    private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
   3.440 +
   3.441 +  
   3.442 +    @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
   3.443 +    public native ImageWrapper getImageForPath(String path);
   3.444 +
   3.445 +    
   3.446 +    
   3.447 +    @Override
   3.448 +    public int getHeight() {
   3.449 +       return canvas.getHeight();
   3.450 +    }
   3.451 +
   3.452 +    @Override
   3.453 +    public int getWidth() {
   3.454 +       return canvas.getWidth();
   3.455 +    }
   3.456 +
   3.457 +    @Override
   3.458 +    public void setHeight(int height) {
   3.459 +       canvas.setHeight(height);
   3.460 +    }
   3.461 +
   3.462 +    @Override
   3.463 +    public void setWidth(int width) {
   3.464 +       canvas.setWidth(width);
   3.465 +    }
   3.466 +
   3.467 +}
     4.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Image.java	Thu May 23 09:56:49 2013 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,46 +0,0 @@
     4.4 -/**
     4.5 - * Back 2 Browser Bytecode Translator
     4.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.7 - *
     4.8 - * This program is free software: you can redistribute it and/or modify
     4.9 - * it under the terms of the GNU General Public License as published by
    4.10 - * the Free Software Foundation, version 2 of the License.
    4.11 - *
    4.12 - * This program is distributed in the hope that it will be useful,
    4.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.15 - * GNU General Public License for more details.
    4.16 - *
    4.17 - * You should have received a copy of the GNU General Public License
    4.18 - * along with this program. Look for COPYING file in the top folder.
    4.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    4.20 - */
    4.21 -package org.apidesign.bck2brwsr.htmlpage.api;
    4.22 -
    4.23 -import net.java.html.canvas.IImage;
    4.24 -
    4.25 -/**
    4.26 - *
    4.27 - * @author Anton Epple <toni.epple@eppleton.de>
    4.28 - */
    4.29 -public class Image extends Element implements IImage{
    4.30 -
    4.31 -    public Image(String id) {
    4.32 -        super(id);
    4.33 -    }
    4.34 -  
    4.35 -    @Override
    4.36 -    void dontSubclass() {
    4.37 -    }
    4.38 -
    4.39 -    @Override
    4.40 -    public int getHeight() {
    4.41 -        return (int) super.getAttribute("height");
    4.42 -    }
    4.43 -
    4.44 -    @Override
    4.45 -    public int getWidth() {
    4.46 -       return (int) super.getAttribute("width");
    4.47 -    }
    4.48 -    
    4.49 -}
     5.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageData.java	Thu May 23 09:56:49 2013 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,90 +0,0 @@
     5.4 -/**
     5.5 - * Back 2 Browser Bytecode Translator
     5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, version 2 of the License.
    5.11 - *
    5.12 - * This program is distributed in the hope that it will be useful,
    5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 - * GNU General Public License for more details.
    5.16 - *
    5.17 - * You should have received a copy of the GNU General Public License
    5.18 - * along with this program. Look for COPYING file in the top folder.
    5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    5.20 - */
    5.21 -/*
    5.22 - * To change this template, choose Tools | Templates
    5.23 - * and open the template in the editor.
    5.24 - */
    5.25 -package org.apidesign.bck2brwsr.htmlpage.api;
    5.26 -
    5.27 -import net.java.html.canvas.IImageData;
    5.28 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    5.29 -
    5.30 -/**
    5.31 - *
    5.32 - * @author Anton Epple <toni.epple@eppleton.de>
    5.33 - */
    5.34 -public class ImageData implements IImageData{
    5.35 -
    5.36 -    private Object imageData;
    5.37 -    private Data data;
    5.38 -
    5.39 -    public ImageData(Object imageData) {
    5.40 -        this.imageData = imageData;
    5.41 -    }
    5.42 -    
    5.43 -    public Data getData(){
    5.44 -        if (data == null){
    5.45 -            data = new Data(getDataImpl(imageData));
    5.46 -        }
    5.47 -        return data;
    5.48 -    }
    5.49 -    
    5.50 -    @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
    5.51 -    public native Object getDataImpl(Object imageData);
    5.52 -
    5.53 -    public double getWidth() {
    5.54 -        return getWidthImpl(imageData);
    5.55 -    }
    5.56 -
    5.57 -    @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
    5.58 -    private static native double getWidthImpl(Object imageData);
    5.59 -
    5.60 -    public double getHeight() {
    5.61 -        return getHeightImpl(imageData);
    5.62 -    }
    5.63 -
    5.64 -    @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
    5.65 -    private static native double getHeightImpl(Object imageData);
    5.66 -
    5.67 -    Object object() {
    5.68 -        return imageData;
    5.69 -    }
    5.70 -
    5.71 -    public static class Data {
    5.72 -
    5.73 -        Object data;
    5.74 -
    5.75 -        public Data(Object data) {
    5.76 -            this.data = data;
    5.77 -        }
    5.78 -
    5.79 -        public int get(int index) {
    5.80 -            return getImpl(data, index);
    5.81 -        }
    5.82 -
    5.83 -        public void set(int index, int value) {
    5.84 -            setImpl(data, index, value);
    5.85 -        }
    5.86 -
    5.87 -        @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
    5.88 -        private static native void setImpl(Object data, int index, int value);
    5.89 -
    5.90 -        @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
    5.91 -        private static native int getImpl(Object data, int index);
    5.92 -    }
    5.93 -}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageDataWrapper.java	Thu May 23 10:02:14 2013 +0200
     6.3 @@ -0,0 +1,90 @@
     6.4 +/**
     6.5 + * Back 2 Browser Bytecode Translator
     6.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.7 + *
     6.8 + * This program is free software: you can redistribute it and/or modify
     6.9 + * it under the terms of the GNU General Public License as published by
    6.10 + * the Free Software Foundation, version 2 of the License.
    6.11 + *
    6.12 + * This program is distributed in the hope that it will be useful,
    6.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.15 + * GNU General Public License for more details.
    6.16 + *
    6.17 + * You should have received a copy of the GNU General Public License
    6.18 + * along with this program. Look for COPYING file in the top folder.
    6.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    6.20 + */
    6.21 +/*
    6.22 + * To change this template, choose Tools | Templates
    6.23 + * and open the template in the editor.
    6.24 + */
    6.25 +package org.apidesign.bck2brwsr.htmlpage.api;
    6.26 +
    6.27 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
    6.28 +
    6.29 +/**
    6.30 + *
    6.31 + * @author Anton Epple <toni.epple@eppleton.de>
    6.32 + */
    6.33 +public class ImageDataWrapper {
    6.34 +
    6.35 +    private Object imageData;
    6.36 +    private Data data;
    6.37 +
    6.38 +    public ImageDataWrapper(Object imageData) {
    6.39 +        this.imageData = imageData;
    6.40 +    }
    6.41 +    
    6.42 +    public Data getData(){
    6.43 +        if (data == null){
    6.44 +            data = new Data(getDataImpl(imageData));
    6.45 +        }
    6.46 +        return data;
    6.47 +    }
    6.48 +    
    6.49 +    @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
    6.50 +    public native Object getDataImpl(Object imageData);
    6.51 +
    6.52 +    public double getWidth() {
    6.53 +        return getWidthImpl(imageData);
    6.54 +    }
    6.55 +
    6.56 +    @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
    6.57 +    private static native double getWidthImpl(Object imageData);
    6.58 +
    6.59 +    public double getHeight() {
    6.60 +        return getHeightImpl(imageData);
    6.61 +    }
    6.62 +
    6.63 +    @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
    6.64 +    private static native double getHeightImpl(Object imageData);
    6.65 +
    6.66 +    Object object() {
    6.67 +        return imageData;
    6.68 +    }
    6.69 +
    6.70 +
    6.71 +    public static class Data {
    6.72 +
    6.73 +        Object data;
    6.74 +
    6.75 +        public Data(Object data) {
    6.76 +            this.data = data;
    6.77 +        }
    6.78 +
    6.79 +        public int get(int index) {
    6.80 +            return getImpl(data, index);
    6.81 +        }
    6.82 +
    6.83 +        public void set(int index, int value) {
    6.84 +            setImpl(data, index, value);
    6.85 +        }
    6.86 +
    6.87 +        @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
    6.88 +        private static native void setImpl(Object data, int index, int value);
    6.89 +
    6.90 +        @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
    6.91 +        private static native int getImpl(Object data, int index);
    6.92 +    }
    6.93 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageWrapper.java	Thu May 23 10:02:14 2013 +0200
     7.3 @@ -0,0 +1,46 @@
     7.4 +/**
     7.5 + * Back 2 Browser Bytecode Translator
     7.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     7.7 + *
     7.8 + * This program is free software: you can redistribute it and/or modify
     7.9 + * it under the terms of the GNU General Public License as published by
    7.10 + * the Free Software Foundation, version 2 of the License.
    7.11 + *
    7.12 + * This program is distributed in the hope that it will be useful,
    7.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.15 + * GNU General Public License for more details.
    7.16 + *
    7.17 + * You should have received a copy of the GNU General Public License
    7.18 + * along with this program. Look for COPYING file in the top folder.
    7.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    7.20 + */
    7.21 +package org.apidesign.bck2brwsr.htmlpage.api;
    7.22 +
    7.23 +import net.java.html.canvas.Image;
    7.24 +
    7.25 +/**
    7.26 + *
    7.27 + * @author Anton Epple <toni.epple@eppleton.de>
    7.28 + */
    7.29 +public class ImageWrapper extends Element implements Image{
    7.30 +
    7.31 +    public ImageWrapper(String id) {
    7.32 +        super(id);
    7.33 +    }
    7.34 +  
    7.35 +    @Override
    7.36 +    void dontSubclass() {
    7.37 +    }
    7.38 +
    7.39 +    @Override
    7.40 +    public double getHeight() {
    7.41 +        return (double) super.getAttribute("height");
    7.42 +    }
    7.43 +
    7.44 +    @Override
    7.45 +    public double getWidth() {
    7.46 +       return (double) super.getAttribute("width");
    7.47 +    }
    7.48 +    
    7.49 +}
     8.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradient.java	Thu May 23 09:56:49 2013 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,47 +0,0 @@
     8.4 -/**
     8.5 - * Back 2 Browser Bytecode Translator
     8.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     8.7 - *
     8.8 - * This program is free software: you can redistribute it and/or modify
     8.9 - * it under the terms of the GNU General Public License as published by
    8.10 - * the Free Software Foundation, version 2 of the License.
    8.11 - *
    8.12 - * This program is distributed in the hope that it will be useful,
    8.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.15 - * GNU General Public License for more details.
    8.16 - *
    8.17 - * You should have received a copy of the GNU General Public License
    8.18 - * along with this program. Look for COPYING file in the top folder.
    8.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    8.20 - */
    8.21 -package org.apidesign.bck2brwsr.htmlpage.api;
    8.22 -
    8.23 -import net.java.html.canvas.ILinearGradient;
    8.24 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    8.25 -
    8.26 -/**
    8.27 - *
    8.28 - * @author Anton Epple <toni.epple@eppleton.de>
    8.29 - */
    8.30 -public class LinearGradient implements ILinearGradient{
    8.31 -
    8.32 -    private final Object gradient;
    8.33 -
    8.34 -    LinearGradient(Object linearGradient) {
    8.35 -        this.gradient = linearGradient;
    8.36 -    }
    8.37 -
    8.38 -    Object object() {
    8.39 -        return gradient;
    8.40 -    }
    8.41 -
    8.42 -    @Override
    8.43 -    public void addColorStop(double position, String color) {
    8.44 -        addColorStopImpl(gradient, position, color);
    8.45 -    }
    8.46 -
    8.47 -    @JavaScriptBody(args = {"gradient", "position", "color"}, body =
    8.48 -            "gradient.addColorStop(position,color)")
    8.49 -    private static native void addColorStopImpl(Object gradient, double position, String color);
    8.50 -}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradientWrapper.java	Thu May 23 10:02:14 2013 +0200
     9.3 @@ -0,0 +1,46 @@
     9.4 +/**
     9.5 + * Back 2 Browser Bytecode Translator
     9.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     9.7 + *
     9.8 + * This program is free software: you can redistribute it and/or modify
     9.9 + * it under the terms of the GNU General Public License as published by
    9.10 + * the Free Software Foundation, version 2 of the License.
    9.11 + *
    9.12 + * This program is distributed in the hope that it will be useful,
    9.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.15 + * GNU General Public License for more details.
    9.16 + *
    9.17 + * You should have received a copy of the GNU General Public License
    9.18 + * along with this program. Look for COPYING file in the top folder.
    9.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    9.20 + */
    9.21 +package org.apidesign.bck2brwsr.htmlpage.api;
    9.22 +
    9.23 +import net.java.html.canvas.LinearGradient;
    9.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
    9.25 +
    9.26 +/**
    9.27 + *
    9.28 + * @author Anton Epple <toni.epple@eppleton.de>
    9.29 + */
    9.30 +public class LinearGradientWrapper{
    9.31 +
    9.32 +    private final Object gradient;
    9.33 +
    9.34 +    LinearGradientWrapper(Object linearGradient) {
    9.35 +        this.gradient = linearGradient;
    9.36 +    }
    9.37 +
    9.38 +    Object object() {
    9.39 +        return gradient;
    9.40 +    }
    9.41 +
    9.42 +    public void addColorStop(double position, String color) {
    9.43 +        addColorStopImpl(gradient, position, color);
    9.44 +    }
    9.45 +
    9.46 +    @JavaScriptBody(args = {"gradient", "position", "color"}, body =
    9.47 +            "gradient.addColorStop(position,color)")
    9.48 +    private static native void addColorStopImpl(Object gradient, double position, String color);
    9.49 +}
    10.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Pattern.java	Thu May 23 09:56:49 2013 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,37 +0,0 @@
    10.4 -/**
    10.5 - * Back 2 Browser Bytecode Translator
    10.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    10.7 - *
    10.8 - * This program is free software: you can redistribute it and/or modify
    10.9 - * it under the terms of the GNU General Public License as published by
   10.10 - * the Free Software Foundation, version 2 of the License.
   10.11 - *
   10.12 - * This program is distributed in the hope that it will be useful,
   10.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.15 - * GNU General Public License for more details.
   10.16 - *
   10.17 - * You should have received a copy of the GNU General Public License
   10.18 - * along with this program. Look for COPYING file in the top folder.
   10.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
   10.20 - */
   10.21 -package org.apidesign.bck2brwsr.htmlpage.api;
   10.22 -
   10.23 -import net.java.html.canvas.IPattern;
   10.24 -
   10.25 -/**
   10.26 - *
   10.27 - * @author Anton Epple <toni.epple@eppleton.de>
   10.28 - */
   10.29 -public class Pattern implements IPattern{
   10.30 -
   10.31 -    private Object pattern;
   10.32 -
   10.33 -    public Pattern(Object pattern) {
   10.34 -        this.pattern = pattern;
   10.35 -    }
   10.36 -
   10.37 -    Object object() {
   10.38 -        return pattern;
   10.39 -    }
   10.40 -}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/PatternWrapper.java	Thu May 23 10:02:14 2013 +0200
    11.3 @@ -0,0 +1,35 @@
    11.4 +/**
    11.5 + * Back 2 Browser Bytecode Translator
    11.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    11.7 + *
    11.8 + * This program is free software: you can redistribute it and/or modify
    11.9 + * it under the terms of the GNU General Public License as published by
   11.10 + * the Free Software Foundation, version 2 of the License.
   11.11 + *
   11.12 + * This program is distributed in the hope that it will be useful,
   11.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.15 + * GNU General Public License for more details.
   11.16 + *
   11.17 + * You should have received a copy of the GNU General Public License
   11.18 + * along with this program. Look for COPYING file in the top folder.
   11.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
   11.20 + */
   11.21 +package org.apidesign.bck2brwsr.htmlpage.api;
   11.22 +
   11.23 +/**
   11.24 + *
   11.25 + * @author Anton Epple <toni.epple@eppleton.de>
   11.26 + */
   11.27 +public class PatternWrapper {
   11.28 +
   11.29 +    private Object pattern;
   11.30 +
   11.31 +    public PatternWrapper(Object pattern) {
   11.32 +        this.pattern = pattern;
   11.33 +    }
   11.34 +
   11.35 +    Object object() {
   11.36 +        return pattern;
   11.37 +    }
   11.38 +}
    12.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradient.java	Thu May 23 09:56:49 2013 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,47 +0,0 @@
    12.4 -/**
    12.5 - * Back 2 Browser Bytecode Translator
    12.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    12.7 - *
    12.8 - * This program is free software: you can redistribute it and/or modify
    12.9 - * it under the terms of the GNU General Public License as published by
   12.10 - * the Free Software Foundation, version 2 of the License.
   12.11 - *
   12.12 - * This program is distributed in the hope that it will be useful,
   12.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12.15 - * GNU General Public License for more details.
   12.16 - *
   12.17 - * You should have received a copy of the GNU General Public License
   12.18 - * along with this program. Look for COPYING file in the top folder.
   12.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
   12.20 - */
   12.21 -package org.apidesign.bck2brwsr.htmlpage.api;
   12.22 -
   12.23 -import net.java.html.canvas.IRadialGradient;
   12.24 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
   12.25 -
   12.26 -/**
   12.27 - *
   12.28 - * @author Anton Epple <toni.epple@eppleton.de>
   12.29 - */
   12.30 -public class RadialGradient implements IRadialGradient{
   12.31 -
   12.32 -    private Object gradient;
   12.33 -
   12.34 -    public RadialGradient(Object radialGradient) {
   12.35 -        this.gradient = radialGradient;
   12.36 -    }
   12.37 -
   12.38 -    @Override
   12.39 -    public void addColorStop(double position, String color) {
   12.40 -        addColorStopImpl(gradient, position, color);
   12.41 -    }
   12.42 -
   12.43 -    @JavaScriptBody(args = {"gradient", "position", "color"}, body =
   12.44 -            "gradient.addColorStop(position,color)")
   12.45 -    private static native void addColorStopImpl(Object gradient, double position, String color);
   12.46 -
   12.47 -    Object object() {
   12.48 -        return gradient;
   12.49 -    }
   12.50 -}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradientWrapper.java	Thu May 23 10:02:14 2013 +0200
    13.3 @@ -0,0 +1,46 @@
    13.4 +/**
    13.5 + * Back 2 Browser Bytecode Translator
    13.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    13.7 + *
    13.8 + * This program is free software: you can redistribute it and/or modify
    13.9 + * it under the terms of the GNU General Public License as published by
   13.10 + * the Free Software Foundation, version 2 of the License.
   13.11 + *
   13.12 + * This program is distributed in the hope that it will be useful,
   13.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13.15 + * GNU General Public License for more details.
   13.16 + *
   13.17 + * You should have received a copy of the GNU General Public License
   13.18 + * along with this program. Look for COPYING file in the top folder.
   13.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
   13.20 + */
   13.21 +package org.apidesign.bck2brwsr.htmlpage.api;
   13.22 +
   13.23 +import net.java.html.canvas.RadialGradient;
   13.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
   13.25 +
   13.26 +/**
   13.27 + *
   13.28 + * @author Anton Epple <toni.epple@eppleton.de>
   13.29 + */
   13.30 +public class RadialGradientWrapper {
   13.31 +
   13.32 +    private Object gradient;
   13.33 +
   13.34 +    public RadialGradientWrapper(Object radialGradient) {
   13.35 +        this.gradient = radialGradient;
   13.36 +    }
   13.37 +
   13.38 +    public void addColorStop(double position, String color) {
   13.39 +        addColorStopImpl(gradient, position, color);
   13.40 +    }
   13.41 +
   13.42 +    @JavaScriptBody(args = {"gradient", "position", "color"}, body =
   13.43 +            "gradient.addColorStop(position,color)")
   13.44 +    private static native void addColorStopImpl(Object gradient, double position, String color);
   13.45 +
   13.46 +    Object object() {
   13.47 +        return gradient;
   13.48 +    }
   13.49 +}
    14.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/TextMetrics.java	Thu May 23 09:56:49 2013 +0200
    14.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/TextMetrics.java	Thu May 23 10:02:14 2013 +0200
    14.3 @@ -17,14 +17,13 @@
    14.4   */
    14.5  package org.apidesign.bck2brwsr.htmlpage.api;
    14.6  
    14.7 -import net.java.html.canvas.ITextMetrics;
    14.8  import org.apidesign.bck2brwsr.core.JavaScriptBody;
    14.9  
   14.10  /**
   14.11   *
   14.12   * @author Anton Epple <toni.epple@eppleton.de>
   14.13   */
   14.14 -public class TextMetrics implements ITextMetrics{
   14.15 +public class TextMetrics {
   14.16  
   14.17      private Object textMetrics;
   14.18  
   14.19 @@ -38,14 +37,11 @@
   14.20      @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.height;")
   14.21      private native double getHeight(Object textMetrics);
   14.22  
   14.23 -    @Override
   14.24      public double getWidth() {
   14.25          return getWidth(textMetrics);
   14.26      }
   14.27  
   14.28 -    @Override
   14.29      public double getHeight() {
   14.30          return getHeight(textMetrics);
   14.31 -
   14.32      }
   14.33  }