# HG changeset patch # User toni.epple@eppleton.de # Date 1368781223 -7200 # Node ID b17053d0671d10dd0be0b928beb44bfd446ee08f # Parent b2b9c398738de0ed7d5e772ac35f958aaa783aeb Started extracting GraphicsContext interface from JavaQuery API. First extracting methods with primitive parameters and return type. diff -r b2b9c398738d -r b17053d0671d javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Fri May 17 11:00:23 2013 +0200 @@ -0,0 +1,186 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package net.java.html.canvas; + +import org.apidesign.bck2brwsr.core.JavaScriptBody; + +/** + * + * @author antonepple + */ +public interface GraphicsContext { + + @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"}, body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);") + void arc(double centerX, double centerY, double startAngle, double radius, double endAngle, boolean ccw); + + @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"}, body = "this._context().arcTo(x1,y1,x2,y2,r);") + void arcTo(double x1, double y1, double x2, double y2, double r); + + @JavaScriptBody(args = {}, body = "this._context().beginPath();") + void beginPath(); + + @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"}, body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);") + void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); + + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);") + void clearRect(double x, double y, double width, double height); + + @JavaScriptBody(args = {}, body = "this._context().clip();") + void clip(); + + @JavaScriptBody(args = {}, body = "this._context().closePath();") + void closePath(); + + @JavaScriptBody(args = {}, body = "this._context().fill();") + void fill(); + + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);") + void fillRect(double x, double y, double width, double height); + + @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);") + void fillText(String text, double x, double y); + + @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);") + void fillText(String text, double x, double y, double maxWidth); + + @JavaScriptBody(args = {}, body = "return this._context().fillStyle;") + String getFillStyle(); + + @JavaScriptBody(args = {}, body = "return this._context().font;") + String getFont(); + + @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;") + double getGlobalAlpha(); + + @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;") + String getGlobalCompositeOperation(); + + @JavaScriptBody(args = {}, body = "return this._context().lineCap;") + String getLineCap(); + + @JavaScriptBody(args = {}, body = "return this._context().lineJoin;") + String getLineJoin(); + + @JavaScriptBody(args = {}, body = "return this._context().lineWidth;") + double getLineWidth(); + + @JavaScriptBody(args = {}, body = "return this._context().miterLimit;") + double getMiterLimit(); + + @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;") + double getShadowBlur(); + + @JavaScriptBody(args = {}, body = "return this._context().shadowColor;") + String getShadowColor(); + + @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;") + double getShadowOffsetX(); + + @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;") + double getShadowOffsetY(); + + @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;") + String getStrokeStyle(); + + @JavaScriptBody(args = {}, body = "return this._context().textAlign;") + String getTextAlign(); + + @JavaScriptBody(args = {}, body = "return this._context().textBaseline;") + String getTextBaseline(); + + @JavaScriptBody(args = {"x", "y"}, body = "return this._context().isPointInPath(x,y);") + boolean isPointInPath(double x, double y); + + @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);") + void lineTo(double x, double y); + + @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);") + void moveTo(double x, double y); + + @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);") + void quadraticCurveTo(double cpx, double cpy, double x, double y); + + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);") + void rect(double x, double y, double width, double height); + + @JavaScriptBody(args = {}, body = "this._context().restore();") + void restore(); + + @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);") + void rotate(double angle); + + @JavaScriptBody(args = {}, body = "this._context().save();") + void save(); + + @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);") + void scale(double x, double y); + + @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();") + void setFillStyle(String style); + + @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();") + void setFont(String font); + + @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;") + void setGlobalAlpha(double alpha); + + @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();") + void setGlobalCompositeOperation(String operation); + + @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();") + void setLineCap(String style); + + @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();") + void setLineJoin(String style); + + @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;") + void setLineWidth(double width); + + @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;") + void setMiterLimit(double limit); + + @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;") + void setShadowBlur(double blur); + + @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();") + void setShadowColor(String color); + + @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;") + void setShadowOffsetX(double x); + + @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;") + void setShadowOffsetY(double y); + + @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();") + void setStrokeStyle(String style); + + @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();") + void setTextAlign(String textAlign); + + @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();") + void setTextBaseline(String textbaseline); + + @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);") + void setTransform(double a, double b, double c, double d, double e, double f); + + @JavaScriptBody(args = {}, body = "this._context().stroke();") + void stroke(); + + @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);") + void strokeRect(double x, double y, double width, double height); + + @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);") + void strokeText(String text, double x, double y); + + @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);") + void strokeText(String text, double x, double y, double maxWidth); + + @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);") + void transform(double a, double b, double c, double d, double e, double f); + + @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);") + void translate(double x, double y); + +}