Refactored names to unpopular naming scheme, because (a) bck2brwsr Canvas implementation must be named Canvas due to mapping in bck2brwsr and I don't want interface and impl to have the same name. (b) with the "I" prefix at least it's consistent, even if nobody uses that anymore. (c) names are the same as in HTML5 Canvas Javascript API, so it's more familiar...
1.1 --- a/javaquery/api/pom.xml Tue May 21 16:07:59 2013 +0200
1.2 +++ b/javaquery/api/pom.xml Tue May 21 16:10:52 2013 +0200
1.3 @@ -80,11 +80,11 @@
1.4 <artifactId>launcher.http</artifactId>
1.5 <version>${project.version}</version>
1.6 <scope>test</scope>
1.7 - </dependency>
1.8 + </dependency>
1.9 <dependency>
1.10 <groupId>net.java.html</groupId>
1.11 <artifactId>canvas</artifactId>
1.12 - <version>${project.version}</version>
1.13 - </dependency>
1.14 + <version>0.8-SNAPSHOT</version>
1.15 + </dependency>
1.16 </dependencies>
1.17 </project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Canvas.java Tue May 21 16:10:52 2013 +0200
2.3 @@ -0,0 +1,70 @@
2.4 +/**
2.5 + * Back 2 Browser Bytecode Translator
2.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details.
2.16 + *
2.17 + * You should have received a copy of the GNU General Public License
2.18 + * along with this program. Look for COPYING file in the top folder.
2.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 + */
2.21 +package org.apidesign.bck2brwsr.htmlpage.api;
2.22 +
2.23 +import net.java.html.canvas.ICanvas;
2.24 +import net.java.html.canvas.IGraphicsContext;
2.25 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
2.26 +import static org.apidesign.bck2brwsr.htmlpage.api.Element.getAttribute;
2.27 +
2.28 +/**
2.29 + *
2.30 + * @author Anton Epple <toni.epple@eppleton.de>
2.31 + */
2.32 +public class Canvas extends Element implements ICanvas{
2.33 +
2.34 + public Canvas(String id) {
2.35 + super(id);
2.36 + }
2.37 +
2.38 + @Override
2.39 + public void setHeight(int height) {
2.40 + setAttribute(this, "height", height);
2.41 + }
2.42 +
2.43 + @Override
2.44 + public int getHeight() {
2.45 + Object ret = getAttribute(this, "height");
2.46 + return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
2.47 + }
2.48 +
2.49 + @Override
2.50 + public void setWidth(int width) {
2.51 + setAttribute(this, "width", width);
2.52 + }
2.53 +
2.54 + @Override
2.55 + public int getWidth() {
2.56 + Object ret = getAttribute(this, "width");
2.57 + return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
2.58 + }
2.59 +
2.60 + @JavaScriptBody(
2.61 + args = {"el"},
2.62 + body = "var e = window.document.getElementById(el._id());\n"
2.63 + + "return e.getContext('2d');\n")
2.64 + private native static Object getContextImpl(Canvas el);
2.65 +
2.66 + public IGraphicsContext getContext() {
2.67 + return new GraphicsContext(getContextImpl(this));
2.68 + }
2.69 +
2.70 + @Override
2.71 + void dontSubclass() {
2.72 + }
2.73 +}
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/GraphicsContext.java Tue May 21 16:10:52 2013 +0200
3.3 @@ -0,0 +1,425 @@
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 +
3.24 +import net.java.html.canvas.IGraphicsContext;
3.25 +import net.java.html.canvas.IImage;
3.26 +import net.java.html.canvas.IImageData;
3.27 +import net.java.html.canvas.ILinearGradient;
3.28 +import net.java.html.canvas.IPattern;
3.29 +import net.java.html.canvas.IRadialGradient;
3.30 +import net.java.html.canvas.ITextMetrics;
3.31 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
3.32 +
3.33 +
3.34 +/**
3.35 + *
3.36 + * @author Anton Epple <toni.epple@eppleton.de>
3.37 + */
3.38 +public class GraphicsContext implements IGraphicsContext {
3.39 +
3.40 + Object context;
3.41 +
3.42 + GraphicsContext(Object contextImpl) {
3.43 + this.context = contextImpl;
3.44 + }
3.45 +
3.46 + @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"},
3.47 + body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
3.48 + @Override
3.49 + public native void arc(double centerX,
3.50 + double centerY,
3.51 + double startAngle,
3.52 + double radius,
3.53 + double endAngle,
3.54 + boolean ccw);
3.55 +
3.56 + @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"},
3.57 + body = "this._context().arcTo(x1,y1,x2,y2,r);")
3.58 + @Override
3.59 + public native void arcTo(double x1,
3.60 + double y1,
3.61 + double x2,
3.62 + double y2,
3.63 + double r);
3.64 +
3.65 + @JavaScriptBody(args = {"x", "y"},
3.66 + body = "return this._context().isPointInPath(x,y);")
3.67 + @Override
3.68 + public native boolean isPointInPath(double x, double y);
3.69 +
3.70 + @JavaScriptBody(args = {}, body = "this._context().fill();")
3.71 + @Override
3.72 + public native void fill();
3.73 +
3.74 + @JavaScriptBody(args = {}, body = "this._context().stroke();")
3.75 + @Override
3.76 + public native void stroke();
3.77 +
3.78 + @JavaScriptBody(args = {}, body = "this._context().beginPath();")
3.79 + @Override
3.80 + public native void beginPath();
3.81 +
3.82 + @JavaScriptBody(args = {}, body = "this._context().closePath();")
3.83 + @Override
3.84 + public native void closePath();
3.85 +
3.86 + @JavaScriptBody(args = {}, body = "this._context().clip();")
3.87 + @Override
3.88 + public native void clip();
3.89 +
3.90 + @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
3.91 + @Override
3.92 + public native void moveTo(double x, double y);
3.93 +
3.94 + @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
3.95 + @Override
3.96 + public native void lineTo(double x, double y);
3.97 +
3.98 + @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
3.99 + @Override
3.100 + public native void quadraticCurveTo(double cpx, double cpy, double x, double y);
3.101 +
3.102 + @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"},
3.103 + body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
3.104 + @Override
3.105 + public native void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
3.106 +
3.107 + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
3.108 + @Override
3.109 + public native void fillRect(double x, double y, double width, double height);
3.110 +
3.111 + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
3.112 + @Override
3.113 + public native void strokeRect(double x, double y, double width, double height);
3.114 +
3.115 + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
3.116 + @Override
3.117 + public native void clearRect(double x, double y, double width, double height);
3.118 +
3.119 + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
3.120 + @Override
3.121 + public native void rect(double x, double y, double width, double height);
3.122 +
3.123 + @JavaScriptBody(args = {}, body = "this._context().save();")
3.124 + @Override
3.125 + public native void save();
3.126 +
3.127 + @JavaScriptBody(args = {}, body = "this._context().restore();")
3.128 + @Override
3.129 + public native void restore();
3.130 +
3.131 + @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
3.132 + @Override
3.133 + public native void rotate(double angle);
3.134 +
3.135 + @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
3.136 + @Override
3.137 + public native void transform(double a, double b, double c, double d, double e, double f);
3.138 +
3.139 + @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
3.140 + @Override
3.141 + public native void setTransform(double a, double b, double c, double d, double e, double f);
3.142 +
3.143 + @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
3.144 + @Override
3.145 + public native void translate(double x, double y);
3.146 +
3.147 + @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
3.148 + @Override
3.149 + public native void scale(double x, double y);
3.150 +
3.151 + @Override
3.152 + public void drawImage(IImage image, double x, double y) {
3.153 + drawImageImpl(context, Element.getElementById((Image) image), x, y);
3.154 + }
3.155 +
3.156 + @Override
3.157 + public void drawImage(IImage image, double x, double y, double width, double height) {
3.158 + drawImageImpl(context, Element.getElementById((Image) image), x, y, width, height);
3.159 + }
3.160 +
3.161 + @Override
3.162 + public void drawImage(IImage image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height) {
3.163 + drawImageImpl(context, Element.getElementById((Image) image), sx, sy, sWidth, sHeight, x, y, width, height);
3.164 + }
3.165 +
3.166 + @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height);")
3.167 + private native static void drawImageImpl(Object ctx, Object img, double x, double y, double width, double height);
3.168 +
3.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);")
3.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);
3.171 +
3.172 + @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "ctx.drawImage(img,x,y);")
3.173 + private native static void drawImageImpl(Object ctx, Object img, double x, double y);
3.174 +
3.175 + @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
3.176 + @Override
3.177 + public native void setFillStyle(String style);
3.178 +
3.179 + @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
3.180 + @Override
3.181 + public native String getFillStyle();
3.182 +
3.183 + @Override
3.184 + public void setFillStyle(ILinearGradient style) {
3.185 + setFillStyleImpl(context, ((LinearGradient) style).object());
3.186 + }
3.187 +
3.188 + @Override
3.189 + public void setFillStyle(IRadialGradient style) {
3.190 + setFillStyleImpl(context, ((RadialGradient) style).object());
3.191 + }
3.192 +
3.193 + @Override
3.194 + public void setFillStyle(IPattern style) {
3.195 + setFillStyleImpl(context, ((Pattern) style).object());
3.196 + }
3.197 +
3.198 + @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
3.199 + private native void setFillStyleImpl(Object context, Object obj);
3.200 +
3.201 + @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
3.202 + @Override
3.203 + public native void setStrokeStyle(String style);
3.204 +
3.205 + @Override
3.206 + public void setStrokeStyle(ILinearGradient style) {
3.207 + setStrokeStyleImpl(context, ((LinearGradient) style).object());
3.208 + }
3.209 +
3.210 + @Override
3.211 + public void setStrokeStyle(IRadialGradient style) {
3.212 + setStrokeStyleImpl(context, ((RadialGradient) style).object());
3.213 + }
3.214 +
3.215 + @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style;")
3.216 + @Override
3.217 + public void setStrokeStyle(IPattern style) {
3.218 + setStrokeStyleImpl(context, ((LinearGradient) style).object());
3.219 + }
3.220 +
3.221 + @JavaScriptBody(args = {"context", "obj"}, body = "context.strokeStyle=obj;")
3.222 + private native void setStrokeStyleImpl(Object context, Object obj);
3.223 +
3.224 + @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
3.225 + @Override
3.226 + public native void setShadowColor(String color);
3.227 +
3.228 + @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
3.229 + @Override
3.230 + public native void setShadowBlur(double blur);
3.231 +
3.232 + @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
3.233 + @Override
3.234 + public native void setShadowOffsetX(double x);
3.235 +
3.236 + @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
3.237 + @Override
3.238 + public native void setShadowOffsetY(double y);
3.239 +
3.240 + @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
3.241 + @Override
3.242 + public native String getStrokeStyle();
3.243 +
3.244 + @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
3.245 + @Override
3.246 + public native String getShadowColor();
3.247 +
3.248 + @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
3.249 + @Override
3.250 + public native double getShadowBlur();
3.251 +
3.252 + @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
3.253 + @Override
3.254 + public native double getShadowOffsetX();
3.255 +
3.256 + @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
3.257 + @Override
3.258 + public native double getShadowOffsetY();
3.259 +
3.260 + @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
3.261 + @Override
3.262 + public native String getLineCap();
3.263 +
3.264 + @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
3.265 + @Override
3.266 + public native void setLineCap(String style);
3.267 +
3.268 + @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
3.269 + @Override
3.270 + public native String getLineJoin();
3.271 +
3.272 + @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
3.273 + @Override
3.274 + public native void setLineJoin(String style);
3.275 +
3.276 + @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
3.277 + @Override
3.278 + public native double getLineWidth();
3.279 +
3.280 + @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
3.281 + @Override
3.282 + public native void setLineWidth(double width);
3.283 +
3.284 + @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
3.285 + @Override
3.286 + public native double getMiterLimit();
3.287 +
3.288 + @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
3.289 + @Override
3.290 + public native void setMiterLimit(double limit);
3.291 +
3.292 + @JavaScriptBody(args = {}, body = "return this._context().font;")
3.293 + @Override
3.294 + public native String getFont();
3.295 +
3.296 + @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
3.297 + @Override
3.298 + public native void setFont(String font);
3.299 +
3.300 + @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
3.301 + @Override
3.302 + public native String getTextAlign();
3.303 +
3.304 + @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
3.305 + @Override
3.306 + public native void setTextAlign(String textAlign);
3.307 +
3.308 + @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
3.309 + @Override
3.310 + public native String getTextBaseline();
3.311 +
3.312 + @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
3.313 + @Override
3.314 + public native void setTextBaseline(String textbaseline);
3.315 +
3.316 + @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
3.317 + @Override
3.318 + public native void fillText(String text, double x, double y);
3.319 +
3.320 + @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
3.321 + @Override
3.322 + public void fillText(String text, double x, double y, double maxWidth) {
3.323 + }
3.324 +
3.325 + @Override
3.326 + public ITextMetrics measureText(String text) {
3.327 + return new TextMetrics(measureTextImpl(text));
3.328 + }
3.329 +
3.330 + @JavaScriptBody(args = {"text"},
3.331 + body = "return this._context().measureText(text);")
3.332 + private native Object measureTextImpl(String text);
3.333 +
3.334 + @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
3.335 + @Override
3.336 + public native void strokeText(String text, double x, double y);
3.337 +
3.338 + @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
3.339 + @Override
3.340 + public native void strokeText(String text, double x, double y, double maxWidth);
3.341 +
3.342 + @Override
3.343 + public IImageData createImageData(double x, double y) {
3.344 + return new ImageData(createImageDataImpl(x, y));
3.345 + }
3.346 +
3.347 + @JavaScriptBody(args = {"x", "y"},
3.348 + body = "return this._context().createImageData(x,y);")
3.349 + private native Object createImageDataImpl(double x, double y);
3.350 +
3.351 + @Override
3.352 + public IImageData createImageData(IImageData imageData) {
3.353 + return new ImageData(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
3.354 + }
3.355 +
3.356 + @Override
3.357 + public IImageData getImageData(double x, double y, double width, double height) {
3.358 + return new ImageData(getImageDataImpl(x, y, width, height));
3.359 + }
3.360 +
3.361 + @JavaScriptBody(args = {"x", "y", "width", "height"},
3.362 + body = "return this._context().getImageData(x,y,width,height);")
3.363 + private native Object getImageDataImpl(double x, double y, double width, double height);
3.364 +
3.365 + @Override
3.366 + public void putImageData(IImageData imageData, double x, double y) {
3.367 + putImageDataImpl(((ImageData) imageData).object(), x, y);
3.368 + }
3.369 +
3.370 + @JavaScriptBody(args = {"imageData", "x", "y"},
3.371 + body = "this._context().putImageData(imageData,x,y);")
3.372 + private native void putImageDataImpl(Object imageData, double x, double y);
3.373 +
3.374 + @Override
3.375 + public void putImageData(IImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
3.376 + putImageDataImpl(((ImageData) imageData).object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
3.377 + }
3.378 +
3.379 + @JavaScriptBody(args = {"imageData", "x", "y", "dirtyx", "dirtyy", "dirtywidth", "dirtyheight"},
3.380 + body = "this._context().putImageData(imageData,x,y, dirtyx, dirtyy, dirtywidth,dirtyheight);")
3.381 + private native void putImageDataImpl(Object imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
3.382 +
3.383 + @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
3.384 + @Override
3.385 + public native void setGlobalAlpha(double alpha);
3.386 +
3.387 + @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
3.388 + @Override
3.389 + public native double getGlobalAlpha();
3.390 +
3.391 + @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
3.392 + @Override
3.393 + public native void setGlobalCompositeOperation(String operation);
3.394 +
3.395 + @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
3.396 + @Override
3.397 + public native String getGlobalCompositeOperation();
3.398 +
3.399 + @Override
3.400 + public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
3.401 + return new LinearGradient(createLinearGradientImpl(context, x0, y0, x1, y1));
3.402 + }
3.403 +
3.404 + @JavaScriptBody(args = {"context", "x0", "y0", "x1", "y1"}, body = "return context.createLinearGradient(x0,y0,x1,y1);")
3.405 + private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
3.406 +
3.407 + @Override
3.408 + public IPattern createPattern(IImage image, String repeat) {
3.409 + return new Pattern(createPatternImpl(context, image, repeat));
3.410 + }
3.411 +
3.412 + @JavaScriptBody(args = {"context", "image", "repeat"}, body = "return context.createPattern(image, repeat);")
3.413 + private static native Object createPatternImpl(Object context, IImage image, String repeat);
3.414 +
3.415 + @Override
3.416 + public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
3.417 + return new RadialGradient(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
3.418 + }
3.419 +
3.420 + @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
3.421 + private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
3.422 +
3.423 + @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
3.424 + @Override
3.425 + public IImage getImageForPath(String path) {
3.426 + throw new UnsupportedOperationException("getImageForPath is not yet supported");
3.427 + }
3.428 +}
4.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Canvas.java Tue May 21 16:07:59 2013 +0200
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,71 +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.Canvas;
4.24 -import net.java.html.canvas.GraphicsContext;
4.25 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
4.26 -import static org.apidesign.bck2brwsr.htmlpage.api.Element.getAttribute;
4.27 -
4.28 -/**
4.29 - *
4.30 - * @author Anton Epple <toni.epple@eppleton.de>
4.31 - */
4.32 -public class HTML5Canvas extends Element implements Canvas{
4.33 -
4.34 - public HTML5Canvas(String id) {
4.35 - super(id);
4.36 - }
4.37 -
4.38 - @Override
4.39 - public void setHeight(int height) {
4.40 - setAttribute(this, "height", height);
4.41 - }
4.42 -
4.43 - @Override
4.44 - public int getHeight() {
4.45 - Object ret = getAttribute(this, "height");
4.46 - return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
4.47 - }
4.48 -
4.49 - @Override
4.50 - public void setWidth(int width) {
4.51 - setAttribute(this, "width", width);
4.52 - }
4.53 -
4.54 - @Override
4.55 - public int getWidth() {
4.56 - Object ret = getAttribute(this, "width");
4.57 - return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
4.58 - }
4.59 -
4.60 - @JavaScriptBody(
4.61 - args = {"el"},
4.62 - body = "var e = window.document.getElementById(el._id());\n"
4.63 - + "return e.getContext('2d');\n")
4.64 - private native static Object getContextImpl(HTML5Canvas el);
4.65 -
4.66 - @Override
4.67 - public GraphicsContext getContext() {
4.68 - return new HTML5GraphicsContext(getContextImpl(this));
4.69 - }
4.70 -
4.71 - @Override
4.72 - void dontSubclass() {
4.73 - }
4.74 -}
5.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java Tue May 21 16:07:59 2013 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,423 +0,0 @@
5.4 -/**
5.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
5.6 - * <jaroslav.tulach@apidesign.org>
5.7 - *
5.8 - * This program is free software: you can redistribute it and/or modify it under
5.9 - * the terms of the GNU General Public License as published by the Free Software
5.10 - * Foundation, version 2 of the License.
5.11 - *
5.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
5.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
5.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
5.15 - * details.
5.16 - *
5.17 - * You should have received a copy of the GNU General Public License along with
5.18 - * this program. Look for COPYING file in the top folder. If not, see
5.19 - * http://opensource.org/licenses/GPL-2.0.
5.20 - */
5.21 -package org.apidesign.bck2brwsr.htmlpage.api;
5.22 -
5.23 -import net.java.html.canvas.GraphicsContext;
5.24 -import net.java.html.canvas.Image;
5.25 -import net.java.html.canvas.ImageData;
5.26 -import net.java.html.canvas.LinearGradient;
5.27 -import net.java.html.canvas.Pattern;
5.28 -import net.java.html.canvas.RadialGradient;
5.29 -import net.java.html.canvas.TextMetrics;
5.30 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
5.31 -
5.32 -/**
5.33 - *
5.34 - * @author Anton Epple <toni.epple@eppleton.de>
5.35 - */
5.36 -public class HTML5GraphicsContext implements GraphicsContext {
5.37 -
5.38 - Object context;
5.39 -
5.40 - HTML5GraphicsContext(Object contextImpl) {
5.41 - this.context = contextImpl;
5.42 - }
5.43 -
5.44 - @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"},
5.45 - body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
5.46 - @Override
5.47 - public native void arc(double centerX,
5.48 - double centerY,
5.49 - double startAngle,
5.50 - double radius,
5.51 - double endAngle,
5.52 - boolean ccw);
5.53 -
5.54 - @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"},
5.55 - body = "this._context().arcTo(x1,y1,x2,y2,r);")
5.56 - @Override
5.57 - public native void arcTo(double x1,
5.58 - double y1,
5.59 - double x2,
5.60 - double y2,
5.61 - double r);
5.62 -
5.63 - @JavaScriptBody(args = {"x", "y"},
5.64 - body = "return this._context().isPointInPath(x,y);")
5.65 - @Override
5.66 - public native boolean isPointInPath(double x, double y);
5.67 -
5.68 - @JavaScriptBody(args = {}, body = "this._context().fill();")
5.69 - @Override
5.70 - public native void fill();
5.71 -
5.72 - @JavaScriptBody(args = {}, body = "this._context().stroke();")
5.73 - @Override
5.74 - public native void stroke();
5.75 -
5.76 - @JavaScriptBody(args = {}, body = "this._context().beginPath();")
5.77 - @Override
5.78 - public native void beginPath();
5.79 -
5.80 - @JavaScriptBody(args = {}, body = "this._context().closePath();")
5.81 - @Override
5.82 - public native void closePath();
5.83 -
5.84 - @JavaScriptBody(args = {}, body = "this._context().clip();")
5.85 - @Override
5.86 - public native void clip();
5.87 -
5.88 - @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
5.89 - @Override
5.90 - public native void moveTo(double x, double y);
5.91 -
5.92 - @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
5.93 - @Override
5.94 - public native void lineTo(double x, double y);
5.95 -
5.96 - @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
5.97 - @Override
5.98 - public native void quadraticCurveTo(double cpx, double cpy, double x, double y);
5.99 -
5.100 - @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"},
5.101 - body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
5.102 - @Override
5.103 - public native void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
5.104 -
5.105 - @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
5.106 - @Override
5.107 - public native void fillRect(double x, double y, double width, double height);
5.108 -
5.109 - @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
5.110 - @Override
5.111 - public native void strokeRect(double x, double y, double width, double height);
5.112 -
5.113 - @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
5.114 - @Override
5.115 - public native void clearRect(double x, double y, double width, double height);
5.116 -
5.117 - @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
5.118 - @Override
5.119 - public native void rect(double x, double y, double width, double height);
5.120 -
5.121 - @JavaScriptBody(args = {}, body = "this._context().save();")
5.122 - @Override
5.123 - public native void save();
5.124 -
5.125 - @JavaScriptBody(args = {}, body = "this._context().restore();")
5.126 - @Override
5.127 - public native void restore();
5.128 -
5.129 - @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
5.130 - @Override
5.131 - public native void rotate(double angle);
5.132 -
5.133 - @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
5.134 - @Override
5.135 - public native void transform(double a, double b, double c, double d, double e, double f);
5.136 -
5.137 - @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
5.138 - @Override
5.139 - public native void setTransform(double a, double b, double c, double d, double e, double f);
5.140 -
5.141 - @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
5.142 - @Override
5.143 - public native void translate(double x, double y);
5.144 -
5.145 - @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
5.146 - @Override
5.147 - public native void scale(double x, double y);
5.148 -
5.149 - @Override
5.150 - public void drawImage(Image image, double x, double y) {
5.151 - drawImageImpl(context, Element.getElementById((HTML5Image) image), x, y);
5.152 - }
5.153 -
5.154 - @Override
5.155 - public void drawImage(Image image, double x, double y, double width, double height) {
5.156 - drawImageImpl(context, Element.getElementById((HTML5Image) image), x, y, width, height);
5.157 - }
5.158 -
5.159 - @Override
5.160 - public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height) {
5.161 - drawImageImpl(context, Element.getElementById((HTML5Image) image), sx, sy, sWidth, sHeight, x, y, width, height);
5.162 - }
5.163 -
5.164 - @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height);")
5.165 - private native static void drawImageImpl(Object ctx, Object img, double x, double y, double width, double height);
5.166 -
5.167 - @JavaScriptBody(args = {"ctx", "img", "sx", "sy", "swidth", "sheight", "x", "y", "width", "height"}, body = "ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);")
5.168 - 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);
5.169 -
5.170 - @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "ctx.drawImage(img,x,y);")
5.171 - private native static void drawImageImpl(Object ctx, Object img, double x, double y);
5.172 -
5.173 - @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
5.174 - @Override
5.175 - public native void setFillStyle(String style);
5.176 -
5.177 - @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
5.178 - @Override
5.179 - public native String getFillStyle();
5.180 -
5.181 - @Override
5.182 - public void setFillStyle(LinearGradient style) {
5.183 - setFillStyleImpl(context, ((HTML5LinearGradient) style).object());
5.184 - }
5.185 -
5.186 - @Override
5.187 - public void setFillStyle(RadialGradient style) {
5.188 - setFillStyleImpl(context, ((HTML5RadialGradient) style).object());
5.189 - }
5.190 -
5.191 - @Override
5.192 - public void setFillStyle(Pattern style) {
5.193 - setFillStyleImpl(context, ((HTML5Pattern) style).object());
5.194 - }
5.195 -
5.196 - @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
5.197 - private native void setFillStyleImpl(Object context, Object obj);
5.198 -
5.199 - @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
5.200 - @Override
5.201 - public native void setStrokeStyle(String style);
5.202 -
5.203 - @Override
5.204 - public void setStrokeStyle(LinearGradient style) {
5.205 - setStrokeStyleImpl(context, ((HTML5LinearGradient) style).object());
5.206 - }
5.207 -
5.208 - @Override
5.209 - public void setStrokeStyle(RadialGradient style) {
5.210 - setStrokeStyleImpl(context, ((HTML5RadialGradient) style).object());
5.211 - }
5.212 -
5.213 - @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style;")
5.214 - @Override
5.215 - public void setStrokeStyle(Pattern style) {
5.216 - setStrokeStyleImpl(context, ((HTML5LinearGradient) style).object());
5.217 - }
5.218 -
5.219 - @JavaScriptBody(args = {"context", "obj"}, body = "context.strokeStyle=obj;")
5.220 - private native void setStrokeStyleImpl(Object context, Object obj);
5.221 -
5.222 - @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
5.223 - @Override
5.224 - public native void setShadowColor(String color);
5.225 -
5.226 - @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
5.227 - @Override
5.228 - public native void setShadowBlur(double blur);
5.229 -
5.230 - @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
5.231 - @Override
5.232 - public native void setShadowOffsetX(double x);
5.233 -
5.234 - @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
5.235 - @Override
5.236 - public native void setShadowOffsetY(double y);
5.237 -
5.238 - @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
5.239 - @Override
5.240 - public native String getStrokeStyle();
5.241 -
5.242 - @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
5.243 - @Override
5.244 - public native String getShadowColor();
5.245 -
5.246 - @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
5.247 - @Override
5.248 - public native double getShadowBlur();
5.249 -
5.250 - @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
5.251 - @Override
5.252 - public native double getShadowOffsetX();
5.253 -
5.254 - @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
5.255 - @Override
5.256 - public native double getShadowOffsetY();
5.257 -
5.258 - @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
5.259 - @Override
5.260 - public native String getLineCap();
5.261 -
5.262 - @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
5.263 - @Override
5.264 - public native void setLineCap(String style);
5.265 -
5.266 - @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
5.267 - @Override
5.268 - public native String getLineJoin();
5.269 -
5.270 - @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
5.271 - @Override
5.272 - public native void setLineJoin(String style);
5.273 -
5.274 - @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
5.275 - @Override
5.276 - public native double getLineWidth();
5.277 -
5.278 - @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
5.279 - @Override
5.280 - public native void setLineWidth(double width);
5.281 -
5.282 - @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
5.283 - @Override
5.284 - public native double getMiterLimit();
5.285 -
5.286 - @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
5.287 - @Override
5.288 - public native void setMiterLimit(double limit);
5.289 -
5.290 - @JavaScriptBody(args = {}, body = "return this._context().font;")
5.291 - @Override
5.292 - public native String getFont();
5.293 -
5.294 - @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
5.295 - @Override
5.296 - public native void setFont(String font);
5.297 -
5.298 - @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
5.299 - @Override
5.300 - public native String getTextAlign();
5.301 -
5.302 - @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
5.303 - @Override
5.304 - public native void setTextAlign(String textAlign);
5.305 -
5.306 - @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
5.307 - @Override
5.308 - public native String getTextBaseline();
5.309 -
5.310 - @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
5.311 - @Override
5.312 - public native void setTextBaseline(String textbaseline);
5.313 -
5.314 - @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
5.315 - @Override
5.316 - public native void fillText(String text, double x, double y);
5.317 -
5.318 - @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
5.319 - @Override
5.320 - public void fillText(String text, double x, double y, double maxWidth) {
5.321 - }
5.322 -
5.323 - @Override
5.324 - public TextMetrics measureText(String text) {
5.325 - return new HTML5TextMetrics(measureTextImpl(text));
5.326 - }
5.327 -
5.328 - @JavaScriptBody(args = {"text"},
5.329 - body = "return this._context().measureText(text);")
5.330 - private native Object measureTextImpl(String text);
5.331 -
5.332 - @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
5.333 - @Override
5.334 - public native void strokeText(String text, double x, double y);
5.335 -
5.336 - @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
5.337 - @Override
5.338 - public native void strokeText(String text, double x, double y, double maxWidth);
5.339 -
5.340 - @Override
5.341 - public ImageData createImageData(double x, double y) {
5.342 - return new HTML5ImageData(createImageDataImpl(x, y));
5.343 - }
5.344 -
5.345 - @JavaScriptBody(args = {"x", "y"},
5.346 - body = "return this._context().createImageData(x,y);")
5.347 - private native Object createImageDataImpl(double x, double y);
5.348 -
5.349 - @Override
5.350 - public ImageData createImageData(ImageData imageData) {
5.351 - return new HTML5ImageData(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
5.352 - }
5.353 -
5.354 - @Override
5.355 - public ImageData getImageData(double x, double y, double width, double height) {
5.356 - return new HTML5ImageData(getImageDataImpl(x, y, width, height));
5.357 - }
5.358 -
5.359 - @JavaScriptBody(args = {"x", "y", "width", "height"},
5.360 - body = "return this._context().getImageData(x,y,width,height);")
5.361 - private native Object getImageDataImpl(double x, double y, double width, double height);
5.362 -
5.363 - @Override
5.364 - public void putImageData(ImageData imageData, double x, double y) {
5.365 - putImageDataImpl(((HTML5ImageData) imageData).object(), x, y);
5.366 - }
5.367 -
5.368 - @JavaScriptBody(args = {"imageData", "x", "y"},
5.369 - body = "this._context().putImageData(imageData,x,y);")
5.370 - private native void putImageDataImpl(Object imageData, double x, double y);
5.371 -
5.372 - @Override
5.373 - public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
5.374 - putImageDataImpl(((HTML5ImageData) imageData).object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
5.375 - }
5.376 -
5.377 - @JavaScriptBody(args = {"imageData", "x", "y", "dirtyx", "dirtyy", "dirtywidth", "dirtyheight"},
5.378 - body = "this._context().putImageData(imageData,x,y, dirtyx, dirtyy, dirtywidth,dirtyheight);")
5.379 - private native void putImageDataImpl(Object imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
5.380 -
5.381 - @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
5.382 - @Override
5.383 - public native void setGlobalAlpha(double alpha);
5.384 -
5.385 - @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
5.386 - @Override
5.387 - public native double getGlobalAlpha();
5.388 -
5.389 - @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
5.390 - @Override
5.391 - public native void setGlobalCompositeOperation(String operation);
5.392 -
5.393 - @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
5.394 - @Override
5.395 - public native String getGlobalCompositeOperation();
5.396 -
5.397 - @Override
5.398 - public HTML5LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
5.399 - return new HTML5LinearGradient(createLinearGradientImpl(context, x0, y0, x1, y1));
5.400 - }
5.401 -
5.402 - @JavaScriptBody(args = {"context", "x0", "y0", "x1", "y1"}, body = "return context.createLinearGradient(x0,y0,x1,y1);")
5.403 - private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
5.404 -
5.405 - @Override
5.406 - public Pattern createPattern(Image image, String repeat) {
5.407 - return new HTML5Pattern(createPatternImpl(context, image, repeat));
5.408 - }
5.409 -
5.410 - @JavaScriptBody(args = {"context", "image", "repeat"}, body = "return context.createPattern(image, repeat);")
5.411 - private static native Object createPatternImpl(Object context, Image image, String repeat);
5.412 -
5.413 - @Override
5.414 - public HTML5RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
5.415 - return new HTML5RadialGradient(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
5.416 - }
5.417 -
5.418 - @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
5.419 - private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
5.420 -
5.421 - @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
5.422 - @Override
5.423 - public Image getImageForPath(String path) {
5.424 - throw new UnsupportedOperationException("getImageForPath is not yet supported");
5.425 - }
5.426 -}
6.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Image.java Tue May 21 16:07:59 2013 +0200
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,46 +0,0 @@
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 -package org.apidesign.bck2brwsr.htmlpage.api;
6.22 -
6.23 -import net.java.html.canvas.Image;
6.24 -
6.25 -/**
6.26 - *
6.27 - * @author Anton Epple <toni.epple@eppleton.de>
6.28 - */
6.29 -public class HTML5Image extends Element implements Image{
6.30 -
6.31 - public HTML5Image(String id) {
6.32 - super(id);
6.33 - }
6.34 -
6.35 - @Override
6.36 - void dontSubclass() {
6.37 - }
6.38 -
6.39 - @Override
6.40 - public int getHeight() {
6.41 - return (int) super.getAttribute("height");
6.42 - }
6.43 -
6.44 - @Override
6.45 - public int getWidth() {
6.46 - return (int) super.getAttribute("width");
6.47 - }
6.48 -
6.49 -}
7.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5ImageData.java Tue May 21 16:07:59 2013 +0200
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,90 +0,0 @@
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 -/*
7.22 - * To change this template, choose Tools | Templates
7.23 - * and open the template in the editor.
7.24 - */
7.25 -package org.apidesign.bck2brwsr.htmlpage.api;
7.26 -
7.27 -import net.java.html.canvas.ImageData;
7.28 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
7.29 -
7.30 -/**
7.31 - *
7.32 - * @author Anton Epple <toni.epple@eppleton.de>
7.33 - */
7.34 -public class HTML5ImageData implements ImageData{
7.35 -
7.36 - private Object imageData;
7.37 - private Data data;
7.38 -
7.39 - public HTML5ImageData(Object imageData) {
7.40 - this.imageData = imageData;
7.41 - }
7.42 -
7.43 - public Data getData(){
7.44 - if (data == null){
7.45 - data = new Data(getDataImpl(imageData));
7.46 - }
7.47 - return data;
7.48 - }
7.49 -
7.50 - @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
7.51 - public native Object getDataImpl(Object imageData);
7.52 -
7.53 - public double getWidth() {
7.54 - return getWidthImpl(imageData);
7.55 - }
7.56 -
7.57 - @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
7.58 - private static native double getWidthImpl(Object imageData);
7.59 -
7.60 - public double getHeight() {
7.61 - return getHeightImpl(imageData);
7.62 - }
7.63 -
7.64 - @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
7.65 - private static native double getHeightImpl(Object imageData);
7.66 -
7.67 - Object object() {
7.68 - return imageData;
7.69 - }
7.70 -
7.71 - public static class Data {
7.72 -
7.73 - Object data;
7.74 -
7.75 - public Data(Object data) {
7.76 - this.data = data;
7.77 - }
7.78 -
7.79 - public int get(int index) {
7.80 - return getImpl(data, index);
7.81 - }
7.82 -
7.83 - public void set(int index, int value) {
7.84 - setImpl(data, index, value);
7.85 - }
7.86 -
7.87 - @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
7.88 - private static native void setImpl(Object data, int index, int value);
7.89 -
7.90 - @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
7.91 - private static native int getImpl(Object data, int index);
7.92 - }
7.93 -}
8.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5LinearGradient.java Tue May 21 16:07:59 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.LinearGradient;
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 HTML5LinearGradient implements LinearGradient{
8.31 -
8.32 - private final Object gradient;
8.33 -
8.34 - HTML5LinearGradient(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 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Pattern.java Tue May 21 16:07:59 2013 +0200
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,37 +0,0 @@
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.Pattern;
9.24 -
9.25 -/**
9.26 - *
9.27 - * @author Anton Epple <toni.epple@eppleton.de>
9.28 - */
9.29 -public class HTML5Pattern implements Pattern{
9.30 -
9.31 - private Object pattern;
9.32 -
9.33 - public HTML5Pattern(Object pattern) {
9.34 - this.pattern = pattern;
9.35 - }
9.36 -
9.37 - Object object() {
9.38 - return pattern;
9.39 - }
9.40 -}
10.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5RadialGradient.java Tue May 21 16:07:59 2013 +0200
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,47 +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.RadialGradient;
10.24 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
10.25 -
10.26 -/**
10.27 - *
10.28 - * @author Anton Epple <toni.epple@eppleton.de>
10.29 - */
10.30 -public class HTML5RadialGradient implements RadialGradient{
10.31 -
10.32 - private Object gradient;
10.33 -
10.34 - public HTML5RadialGradient(Object radialGradient) {
10.35 - this.gradient = radialGradient;
10.36 - }
10.37 -
10.38 - @Override
10.39 - public void addColorStop(double position, String color) {
10.40 - addColorStopImpl(gradient, position, color);
10.41 - }
10.42 -
10.43 - @JavaScriptBody(args = {"gradient", "position", "color"}, body =
10.44 - "gradient.addColorStop(position,color)")
10.45 - private static native void addColorStopImpl(Object gradient, double position, String color);
10.46 -
10.47 - Object object() {
10.48 - return gradient;
10.49 - }
10.50 -}
11.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5TextMetrics.java Tue May 21 16:07:59 2013 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,51 +0,0 @@
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 -import net.java.html.canvas.TextMetrics;
11.24 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
11.25 -
11.26 -/**
11.27 - *
11.28 - * @author Anton Epple <toni.epple@eppleton.de>
11.29 - */
11.30 -public class HTML5TextMetrics implements TextMetrics{
11.31 -
11.32 - private Object textMetrics;
11.33 -
11.34 - HTML5TextMetrics(Object measureTextImpl) {
11.35 - this.textMetrics = measureTextImpl;
11.36 - }
11.37 -
11.38 - @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.width;")
11.39 - private native double getWidth(Object textMetrics);
11.40 -
11.41 - @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.height;")
11.42 - private native double getHeight(Object textMetrics);
11.43 -
11.44 - @Override
11.45 - public double getWidth() {
11.46 - return getWidth(textMetrics);
11.47 - }
11.48 -
11.49 - @Override
11.50 - public double getHeight() {
11.51 - return getHeight(textMetrics);
11.52 -
11.53 - }
11.54 -}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Image.java Tue May 21 16:10:52 2013 +0200
12.3 @@ -0,0 +1,46 @@
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.IImage;
12.24 +
12.25 +/**
12.26 + *
12.27 + * @author Anton Epple <toni.epple@eppleton.de>
12.28 + */
12.29 +public class Image extends Element implements IImage{
12.30 +
12.31 + public Image(String id) {
12.32 + super(id);
12.33 + }
12.34 +
12.35 + @Override
12.36 + void dontSubclass() {
12.37 + }
12.38 +
12.39 + @Override
12.40 + public int getHeight() {
12.41 + return (int) super.getAttribute("height");
12.42 + }
12.43 +
12.44 + @Override
12.45 + public int getWidth() {
12.46 + return (int) super.getAttribute("width");
12.47 + }
12.48 +
12.49 +}
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/ImageData.java Tue May 21 16:10:52 2013 +0200
13.3 @@ -0,0 +1,90 @@
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 +/*
13.22 + * To change this template, choose Tools | Templates
13.23 + * and open the template in the editor.
13.24 + */
13.25 +package org.apidesign.bck2brwsr.htmlpage.api;
13.26 +
13.27 +import net.java.html.canvas.IImageData;
13.28 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
13.29 +
13.30 +/**
13.31 + *
13.32 + * @author Anton Epple <toni.epple@eppleton.de>
13.33 + */
13.34 +public class ImageData implements IImageData{
13.35 +
13.36 + private Object imageData;
13.37 + private Data data;
13.38 +
13.39 + public ImageData(Object imageData) {
13.40 + this.imageData = imageData;
13.41 + }
13.42 +
13.43 + public Data getData(){
13.44 + if (data == null){
13.45 + data = new Data(getDataImpl(imageData));
13.46 + }
13.47 + return data;
13.48 + }
13.49 +
13.50 + @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
13.51 + public native Object getDataImpl(Object imageData);
13.52 +
13.53 + public double getWidth() {
13.54 + return getWidthImpl(imageData);
13.55 + }
13.56 +
13.57 + @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
13.58 + private static native double getWidthImpl(Object imageData);
13.59 +
13.60 + public double getHeight() {
13.61 + return getHeightImpl(imageData);
13.62 + }
13.63 +
13.64 + @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
13.65 + private static native double getHeightImpl(Object imageData);
13.66 +
13.67 + Object object() {
13.68 + return imageData;
13.69 + }
13.70 +
13.71 + public static class Data {
13.72 +
13.73 + Object data;
13.74 +
13.75 + public Data(Object data) {
13.76 + this.data = data;
13.77 + }
13.78 +
13.79 + public int get(int index) {
13.80 + return getImpl(data, index);
13.81 + }
13.82 +
13.83 + public void set(int index, int value) {
13.84 + setImpl(data, index, value);
13.85 + }
13.86 +
13.87 + @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
13.88 + private static native void setImpl(Object data, int index, int value);
13.89 +
13.90 + @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
13.91 + private static native int getImpl(Object data, int index);
13.92 + }
13.93 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradient.java Tue May 21 16:10:52 2013 +0200
14.3 @@ -0,0 +1,47 @@
14.4 +/**
14.5 + * Back 2 Browser Bytecode Translator
14.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
14.7 + *
14.8 + * This program is free software: you can redistribute it and/or modify
14.9 + * it under the terms of the GNU General Public License as published by
14.10 + * the Free Software Foundation, version 2 of the License.
14.11 + *
14.12 + * This program is distributed in the hope that it will be useful,
14.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14.15 + * GNU General Public License for more details.
14.16 + *
14.17 + * You should have received a copy of the GNU General Public License
14.18 + * along with this program. Look for COPYING file in the top folder.
14.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
14.20 + */
14.21 +package org.apidesign.bck2brwsr.htmlpage.api;
14.22 +
14.23 +import net.java.html.canvas.ILinearGradient;
14.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
14.25 +
14.26 +/**
14.27 + *
14.28 + * @author Anton Epple <toni.epple@eppleton.de>
14.29 + */
14.30 +public class LinearGradient implements ILinearGradient{
14.31 +
14.32 + private final Object gradient;
14.33 +
14.34 + LinearGradient(Object linearGradient) {
14.35 + this.gradient = linearGradient;
14.36 + }
14.37 +
14.38 + Object object() {
14.39 + return gradient;
14.40 + }
14.41 +
14.42 + @Override
14.43 + public void addColorStop(double position, String color) {
14.44 + addColorStopImpl(gradient, position, color);
14.45 + }
14.46 +
14.47 + @JavaScriptBody(args = {"gradient", "position", "color"}, body =
14.48 + "gradient.addColorStop(position,color)")
14.49 + private static native void addColorStopImpl(Object gradient, double position, String color);
14.50 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Pattern.java Tue May 21 16:10:52 2013 +0200
15.3 @@ -0,0 +1,37 @@
15.4 +/**
15.5 + * Back 2 Browser Bytecode Translator
15.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
15.7 + *
15.8 + * This program is free software: you can redistribute it and/or modify
15.9 + * it under the terms of the GNU General Public License as published by
15.10 + * the Free Software Foundation, version 2 of the License.
15.11 + *
15.12 + * This program is distributed in the hope that it will be useful,
15.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.15 + * GNU General Public License for more details.
15.16 + *
15.17 + * You should have received a copy of the GNU General Public License
15.18 + * along with this program. Look for COPYING file in the top folder.
15.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
15.20 + */
15.21 +package org.apidesign.bck2brwsr.htmlpage.api;
15.22 +
15.23 +import net.java.html.canvas.IPattern;
15.24 +
15.25 +/**
15.26 + *
15.27 + * @author Anton Epple <toni.epple@eppleton.de>
15.28 + */
15.29 +public class Pattern implements IPattern{
15.30 +
15.31 + private Object pattern;
15.32 +
15.33 + public Pattern(Object pattern) {
15.34 + this.pattern = pattern;
15.35 + }
15.36 +
15.37 + Object object() {
15.38 + return pattern;
15.39 + }
15.40 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradient.java Tue May 21 16:10:52 2013 +0200
16.3 @@ -0,0 +1,47 @@
16.4 +/**
16.5 + * Back 2 Browser Bytecode Translator
16.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
16.7 + *
16.8 + * This program is free software: you can redistribute it and/or modify
16.9 + * it under the terms of the GNU General Public License as published by
16.10 + * the Free Software Foundation, version 2 of the License.
16.11 + *
16.12 + * This program is distributed in the hope that it will be useful,
16.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.15 + * GNU General Public License for more details.
16.16 + *
16.17 + * You should have received a copy of the GNU General Public License
16.18 + * along with this program. Look for COPYING file in the top folder.
16.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
16.20 + */
16.21 +package org.apidesign.bck2brwsr.htmlpage.api;
16.22 +
16.23 +import net.java.html.canvas.IRadialGradient;
16.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
16.25 +
16.26 +/**
16.27 + *
16.28 + * @author Anton Epple <toni.epple@eppleton.de>
16.29 + */
16.30 +public class RadialGradient implements IRadialGradient{
16.31 +
16.32 + private Object gradient;
16.33 +
16.34 + public RadialGradient(Object radialGradient) {
16.35 + this.gradient = radialGradient;
16.36 + }
16.37 +
16.38 + @Override
16.39 + public void addColorStop(double position, String color) {
16.40 + addColorStopImpl(gradient, position, color);
16.41 + }
16.42 +
16.43 + @JavaScriptBody(args = {"gradient", "position", "color"}, body =
16.44 + "gradient.addColorStop(position,color)")
16.45 + private static native void addColorStopImpl(Object gradient, double position, String color);
16.46 +
16.47 + Object object() {
16.48 + return gradient;
16.49 + }
16.50 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/TextMetrics.java Tue May 21 16:10:52 2013 +0200
17.3 @@ -0,0 +1,51 @@
17.4 +/**
17.5 + * Back 2 Browser Bytecode Translator
17.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
17.7 + *
17.8 + * This program is free software: you can redistribute it and/or modify
17.9 + * it under the terms of the GNU General Public License as published by
17.10 + * the Free Software Foundation, version 2 of the License.
17.11 + *
17.12 + * This program is distributed in the hope that it will be useful,
17.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17.15 + * GNU General Public License for more details.
17.16 + *
17.17 + * You should have received a copy of the GNU General Public License
17.18 + * along with this program. Look for COPYING file in the top folder.
17.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
17.20 + */
17.21 +package org.apidesign.bck2brwsr.htmlpage.api;
17.22 +
17.23 +import net.java.html.canvas.ITextMetrics;
17.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
17.25 +
17.26 +/**
17.27 + *
17.28 + * @author Anton Epple <toni.epple@eppleton.de>
17.29 + */
17.30 +public class TextMetrics implements ITextMetrics{
17.31 +
17.32 + private Object textMetrics;
17.33 +
17.34 + TextMetrics(Object measureTextImpl) {
17.35 + this.textMetrics = measureTextImpl;
17.36 + }
17.37 +
17.38 + @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.width;")
17.39 + private native double getWidth(Object textMetrics);
17.40 +
17.41 + @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.height;")
17.42 + private native double getHeight(Object textMetrics);
17.43 +
17.44 + @Override
17.45 + public double getWidth() {
17.46 + return getWidth(textMetrics);
17.47 + }
17.48 +
17.49 + @Override
17.50 + public double getHeight() {
17.51 + return getHeight(textMetrics);
17.52 +
17.53 + }
17.54 +}