javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
author toni.epple@eppleton.de
Fri, 17 May 2013 11:00:23 +0200
branchcanvas
changeset 1109 b17053d0671d
parent 871 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/GraphicsContext.java@6168fb585ab4
child 1111 8c88d0f187d8
permissions -rw-r--r--
Started extracting GraphicsContext interface from JavaQuery API. First extracting methods with primitive parameters and return type.
     1 /*
     2  * To change this template, choose Tools | Templates
     3  * and open the template in the editor.
     4  */
     5 package net.java.html.canvas;
     6 
     7 import org.apidesign.bck2brwsr.core.JavaScriptBody;
     8 
     9 /**
    10  *
    11  * @author antonepple
    12  */
    13 public interface GraphicsContext {
    14 
    15     @JavaScriptBody(args = {"centerx", "centery", "radius", "startangle", "endangle", "ccw"}, body = "this._context().arc(centerx,centery, radius, startangle, endangle,ccw);")
    16     void arc(double centerX, double centerY, double startAngle, double radius, double endAngle, boolean ccw);
    17 
    18     @JavaScriptBody(args = {"x1", "y1", "x2", "y2", "r"}, body = "this._context().arcTo(x1,y1,x2,y2,r);")
    19     void arcTo(double x1, double y1, double x2, double y2, double r);
    20 
    21     @JavaScriptBody(args = {}, body = "this._context().beginPath();")
    22     void beginPath();
    23 
    24     @JavaScriptBody(args = {"cp1x", "cp1y", "cp2x", "cp2y", "x", "y"}, body = "this._context().bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);")
    25     void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    26 
    27     @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().clearRect(x,y,width,height);")
    28     void clearRect(double x, double y, double width, double height);
    29 
    30     @JavaScriptBody(args = {}, body = "this._context().clip();")
    31     void clip();
    32 
    33     @JavaScriptBody(args = {}, body = "this._context().closePath();")
    34     void closePath();
    35 
    36     @JavaScriptBody(args = {}, body = "this._context().fill();")
    37     void fill();
    38 
    39     @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().fillRect(x,y,width,height);")
    40     void fillRect(double x, double y, double width, double height);
    41 
    42     @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().fillText(text,x,y);")
    43     void fillText(String text, double x, double y);
    44 
    45     @JavaScriptBody(args = {"text", "x", "y", "maxwidth"}, body = "this._context().fillText(text,x,y,maxwidth);")
    46     void fillText(String text, double x, double y, double maxWidth);
    47 
    48     @JavaScriptBody(args = {}, body = "return this._context().fillStyle;")
    49     String getFillStyle();
    50 
    51     @JavaScriptBody(args = {}, body = "return this._context().font;")
    52     String getFont();
    53 
    54     @JavaScriptBody(args = {}, body = "return this._context().globalAlpha;")
    55     double getGlobalAlpha();
    56 
    57     @JavaScriptBody(args = {}, body = "return this._context().globalCompositeOperation;")
    58     String getGlobalCompositeOperation();
    59 
    60     @JavaScriptBody(args = {}, body = "return this._context().lineCap;")
    61     String getLineCap();
    62 
    63     @JavaScriptBody(args = {}, body = "return this._context().lineJoin;")
    64     String getLineJoin();
    65 
    66     @JavaScriptBody(args = {}, body = "return this._context().lineWidth;")
    67     double getLineWidth();
    68 
    69     @JavaScriptBody(args = {}, body = "return this._context().miterLimit;")
    70     double getMiterLimit();
    71 
    72     @JavaScriptBody(args = {}, body = "return this._context().shadowBlur;")
    73     double getShadowBlur();
    74 
    75     @JavaScriptBody(args = {}, body = "return this._context().shadowColor;")
    76     String getShadowColor();
    77 
    78     @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetX;")
    79     double getShadowOffsetX();
    80 
    81     @JavaScriptBody(args = {}, body = "return this._context().shadowOffsetY;")
    82     double getShadowOffsetY();
    83 
    84     @JavaScriptBody(args = {}, body = "return this._context().strokeStyle;")
    85     String getStrokeStyle();
    86 
    87     @JavaScriptBody(args = {}, body = "return this._context().textAlign;")
    88     String getTextAlign();
    89 
    90     @JavaScriptBody(args = {}, body = "return this._context().textBaseline;")
    91     String getTextBaseline();
    92 
    93     @JavaScriptBody(args = {"x", "y"}, body = "return this._context().isPointInPath(x,y);")
    94     boolean isPointInPath(double x, double y);
    95 
    96     @JavaScriptBody(args = {"x", "y"}, body = "this._context().lineTo(x,y);")
    97     void lineTo(double x, double y);
    98 
    99     @JavaScriptBody(args = {"x", "y"}, body = "this._context().moveTo(x,y);")
   100     void moveTo(double x, double y);
   101 
   102     @JavaScriptBody(args = {"cpx", "cpy", "x", "y"}, body = "this._context().quadraticCurveTo(cpx,cpy,x,y);")
   103     void quadraticCurveTo(double cpx, double cpy, double x, double y);
   104 
   105     @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().rectect(x,y,width,height);")
   106     void rect(double x, double y, double width, double height);
   107 
   108     @JavaScriptBody(args = {}, body = "this._context().restore();")
   109     void restore();
   110 
   111     @JavaScriptBody(args = {"angle"}, body = "this._context().rotate(angle);")
   112     void rotate(double angle);
   113 
   114     @JavaScriptBody(args = {}, body = "this._context().save();")
   115     void save();
   116 
   117     @JavaScriptBody(args = {"x", "y"}, body = "this._context().scale(x,y);")
   118     void scale(double x, double y);
   119 
   120     @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style.valueOf();")
   121     void setFillStyle(String style);
   122 
   123     @JavaScriptBody(args = {"font"}, body = "this._context().font=font.valueOf();")
   124     void setFont(String font);
   125 
   126     @JavaScriptBody(args = {"alpha"}, body = "this._context().globalAlpha=alpha;")
   127     void setGlobalAlpha(double alpha);
   128 
   129     @JavaScriptBody(args = {"operation"}, body = "this._context().globalCompositeOperation=operation.valueOf();")
   130     void setGlobalCompositeOperation(String operation);
   131 
   132     @JavaScriptBody(args = {"style"}, body = "this._context().lineCap=style.valueOf();")
   133     void setLineCap(String style);
   134 
   135     @JavaScriptBody(args = {"style"}, body = "this._context().lineJoin=style.valueOf();")
   136     void setLineJoin(String style);
   137 
   138     @JavaScriptBody(args = {"width"}, body = "this._context().lineWidth=width;")
   139     void setLineWidth(double width);
   140 
   141     @JavaScriptBody(args = {"limit"}, body = "this._context().miterLimit=limit;")
   142     void setMiterLimit(double limit);
   143 
   144     @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
   145     void setShadowBlur(double blur);
   146 
   147     @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
   148     void setShadowColor(String color);
   149 
   150     @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
   151     void setShadowOffsetX(double x);
   152 
   153     @JavaScriptBody(args = {"y"}, body = "this._context().shadowOffsetY=y;")
   154     void setShadowOffsetY(double y);
   155 
   156     @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
   157     void setStrokeStyle(String style);
   158 
   159     @JavaScriptBody(args = {"textalign"}, body = "this._context().textAlign=textalign.valueOf();")
   160     void setTextAlign(String textAlign);
   161 
   162     @JavaScriptBody(args = {"textbaseline"}, body = "this._context().textBaseline=textbaseline.valueOf();")
   163     void setTextBaseline(String textbaseline);
   164 
   165     @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().setTransform(a,b,c,d,e,f);")
   166     void setTransform(double a, double b, double c, double d, double e, double f);
   167 
   168     @JavaScriptBody(args = {}, body = "this._context().stroke();")
   169     void stroke();
   170 
   171     @JavaScriptBody(args = {"x", "y", "width", "height"}, body = "this._context().strokeRect(x,y,width,height);")
   172     void strokeRect(double x, double y, double width, double height);
   173 
   174     @JavaScriptBody(args = {"text", "x", "y"}, body = "this._context().strokeText(text,x,y);")
   175     void strokeText(String text, double x, double y);
   176 
   177     @JavaScriptBody(args = {"text", "x", "y", "maxWidth"}, body = "this._context().strokeText(text,x,y,maxWidth);")
   178     void strokeText(String text, double x, double y, double maxWidth);
   179 
   180     @JavaScriptBody(args = {"a", "b", "c", "d", "e", "f"}, body = "this._context().transform(a,b,c,d,e,f);")
   181     void transform(double a, double b, double c, double d, double e, double f);
   182 
   183     @JavaScriptBody(args = {"x", "y"}, body = "this._context().translate(x,y);")
   184     void translate(double x, double y);
   185     
   186 }