toni@1109: /* toni@1109: * To change this template, choose Tools | Templates toni@1109: * and open the template in the editor. toni@521: */ toni@1109: package net.java.html.canvas; toni@521: toni@521: import org.apidesign.bck2brwsr.core.JavaScriptBody; toni@521: toni@521: /** toni@521: * toni@1109: * @author antonepple toni@521: */ toni@1109: public interface GraphicsContext { toni@521: toni@1109: @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"}, body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);") toni@1109: void arc(double centerX, double centerY, double startAngle, double radius, double endAngle, boolean ccw); toni@521: toni@1109: @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"}, body = "this._context().arcTo(x1,y1,x2,y2,r);") toni@1109: void arcTo(double x1, double y1, double x2, double y2, double r); toni@521: toni@1109: @JavaScriptBody(args = {}, body = "this._context().beginPath();") toni@1109: void beginPath(); toni@521: toni@1109: @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"}, body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);") toni@1109: void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); toni@521: toni@1109: @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);") toni@1109: void clearRect(double x, double y, double width, double height); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "this._context().clip();") toni@1109: void clip(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "this._context().closePath();") toni@1109: void closePath(); toni@521: jaroslav@592: @JavaScriptBody(args = {}, body = "this._context().fill();") toni@1109: void fill(); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);") toni@1109: void fillRect(double x, double y, double width, double height); toni@1109: toni@1109: @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);") toni@1109: void fillText(String text, double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);") toni@1109: void fillText(String text, double x, double y, double maxWidth); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().fillStyle;") toni@1109: String getFillStyle(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().font;") toni@1109: String getFont(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;") toni@1109: double getGlobalAlpha(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;") toni@1109: String getGlobalCompositeOperation(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().lineCap;") toni@1109: String getLineCap(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().lineJoin;") toni@1109: String getLineJoin(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().lineWidth;") toni@1109: double getLineWidth(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().miterLimit;") toni@1109: double getMiterLimit(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;") toni@1109: double getShadowBlur(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().shadowColor;") toni@1109: String getShadowColor(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;") toni@1109: double getShadowOffsetX(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;") toni@1109: double getShadowOffsetY(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;") toni@1109: String getStrokeStyle(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().textAlign;") toni@1109: String getTextAlign(); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "return this._context().textBaseline;") toni@1109: String getTextBaseline(); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y"}, body = "return this._context().isPointInPath(x,y);") toni@1109: boolean isPointInPath(double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);") toni@1109: void lineTo(double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);") toni@1109: void moveTo(double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);") toni@1109: void quadraticCurveTo(double cpx, double cpy, double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);") toni@1109: void rect(double x, double y, double width, double height); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "this._context().restore();") toni@1109: void restore(); toni@1109: toni@1109: @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);") toni@1109: void rotate(double angle); toni@1109: toni@1109: @JavaScriptBody(args = {}, body = "this._context().save();") toni@1109: void save(); toni@1109: toni@1109: @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);") toni@1109: void scale(double x, double y); toni@1109: toni@1109: @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();") toni@1109: void setFillStyle(String style); toni@1109: toni@1109: @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();") toni@1109: void setFont(String font); toni@1109: toni@1109: @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;") toni@1109: void setGlobalAlpha(double alpha); toni@1109: toni@1109: @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();") toni@1109: void setGlobalCompositeOperation(String operation); toni@1109: toni@1109: @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();") toni@1109: void setLineCap(String style); toni@1109: toni@1109: @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();") toni@1109: void setLineJoin(String style); toni@1109: toni@1109: @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;") toni@1109: void setLineWidth(double width); toni@1109: toni@1109: @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;") toni@1109: void setMiterLimit(double limit); toni@1109: toni@1109: @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;") toni@1109: void setShadowBlur(double blur); toni@1109: toni@1109: @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();") toni@1109: void setShadowColor(String color); toni@1109: toni@1109: @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;") toni@1109: void setShadowOffsetX(double x); toni@1109: toni@1109: @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;") toni@1109: void setShadowOffsetY(double y); toni@1109: toni@1109: @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();") toni@1109: void setStrokeStyle(String style); toni@1109: toni@1109: @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();") toni@1109: void setTextAlign(String textAlign); toni@1109: toni@1109: @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();") toni@1109: void setTextBaseline(String textbaseline); toni@1109: toni@1109: @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);") toni@1109: void setTransform(double a, double b, double c, double d, double e, double f); toni@521: jaroslav@592: @JavaScriptBody(args = {}, body = "this._context().stroke();") toni@1109: void stroke(); toni@521: jaroslav@592: @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);") toni@1109: void strokeRect(double x, double y, double width, double height); toni@521: toni@1109: @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);") toni@1109: void strokeText(String text, double x, double y); toni@521: toni@1109: @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);") toni@1109: void strokeText(String text, double x, double y, double maxWidth); toni@521: jaroslav@592: @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);") toni@1109: void transform(double a, double b, double c, double d, double e, double f); toni@521: jaroslav@592: @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);") toni@1109: void translate(double x, double y); toni@521: toni@521: }