javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java
author Anton Epple <toni.epple@eppleton.de>
Thu, 23 May 2013 15:36:42 +0200
branchcanvas
changeset 1136 591d06d8e06f
parent 1133 javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java@0ae830f00e0c
child 1137 964e42c9448d
permissions -rw-r--r--
moved GRaphicsEnvironment to SPI package
     1 /**
     2  * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     3  * <jaroslav.tulach@apidesign.org>
     4  *
     5  * This program is free software: you can redistribute it and/or modify it under
     6  * the terms of the GNU General Public License as published by the Free Software
     7  * Foundation, version 2 of the License.
     8  *
     9  * This program is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    12  * details.
    13  *
    14  * You should have received a copy of the GNU General Public License along with
    15  * this program. Look for COPYING file in the top folder. If not, see
    16  * http://opensource.org/licenses/GPL-2.0.
    17  */
    18 package net.java.html.canvas.spi;
    19 
    20 import java.awt.Dimension;
    21 import net.java.html.canvas.ImageData;
    22 import net.java.html.canvas.Style;
    23 
    24 /**
    25  * Provider API for Canvas. Implement this to add support for your platform.
    26  * @author antonepple
    27  */
    28 public interface GraphicsEnvironment {
    29 
    30     public void arc(double centerX,
    31             double centerY,
    32             double startAngle,
    33             double radius,
    34             double endAngle,
    35             boolean ccw);
    36 
    37     public void arcTo(double x1,
    38             double y1,
    39             double x2,
    40             double y2,
    41             double r);
    42 
    43     public boolean isPointInPath(double x, double y);
    44 
    45     public void fill();
    46 
    47     public void stroke();
    48 
    49     public void beginPath();
    50 
    51     public void closePath();
    52 
    53     public void clip();
    54 
    55     public void moveTo(double x, double y);
    56 
    57     public void lineTo(double x, double y);
    58 
    59     public void quadraticCurveTo(double cpx, double cpy, double x, double y);
    60 
    61     public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    62 
    63     public void fillRect(double x, double y, double width, double height);
    64 
    65     public void strokeRect(double x, double y, double width, double height);
    66 
    67     public void clearRect(double x, double y, double width, double height);
    68 
    69     public void rect(double x, double y, double width, double height);
    70 
    71     public void save();
    72 
    73     public void restore();
    74 
    75     public void rotate(double angle);
    76 
    77     public void transform(double a, double b, double c, double d, double e, double f);
    78 
    79     public void setTransform(double a, double b, double c, double d, double e, double f);
    80 
    81     public void translate(double x, double y);
    82 
    83     public void scale(double x, double y);
    84 
    85     public void drawImage(ImageData image, double x, double y);
    86 
    87     public void drawImage(ImageData image, double x, double y, double width, double height);
    88 
    89     public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
    90 
    91     public void setFillStyle(String style);
    92 
    93     public String getFillStyle();
    94 
    95     public void setFillStyle(Style style);
    96 
    97     public void setStrokeStyle(String style);
    98 
    99     public void setStrokeStyle(Style style);
   100 
   101     public void setShadowColor(String color);
   102 
   103     public void setShadowBlur(double blur);
   104 
   105     public void setShadowOffsetX(double x);
   106 
   107     public void setShadowOffsetY(double y);
   108 
   109     public String getStrokeStyle();
   110 
   111     public String getShadowColor();
   112 
   113     public double getShadowBlur();
   114 
   115     public double getShadowOffsetX();
   116 
   117     public double getShadowOffsetY();
   118 
   119     public String getLineCap();
   120 
   121     public void setLineCap(String style);
   122 
   123     public String getLineJoin();
   124 
   125     public void setLineJoin(String style);
   126 
   127     public double getLineWidth();
   128 
   129     public void setLineWidth(double width);
   130 
   131     public double getMiterLimit();
   132 
   133     public void setMiterLimit(double limit);
   134 
   135     public String getFont();
   136 
   137     public void setFont(String font);
   138 
   139     public String getTextAlign();
   140 
   141     public void setTextAlign(String textAlign);
   142 
   143     public String getTextBaseline();
   144 
   145     public void setTextBaseline(String textbaseline);
   146 
   147     public void fillText(String text, double x, double y);
   148 
   149     public void fillText(String text, double x, double y, double maxWidth);
   150 
   151     public Dimension measureText(String text);
   152 
   153     public void strokeText(String text, double x, double y);
   154 
   155     public void strokeText(String text, double x, double y, double maxWidth);
   156 
   157 //    public ImageData createImageData(double x, double y);
   158 //
   159 //    public ImageData createImageData(ImageData imageData);
   160 //
   161 //    public ImageData getImageData(double x, double y, double width, double height);
   162 //
   163 //    public void putImageData(ImageData imageData, double x, double y);
   164 //
   165 //    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   166 
   167     public void setGlobalAlpha(double alpha);
   168 
   169     public double getGlobalAlpha();
   170 
   171     public void setGlobalCompositeOperation(String operation);
   172 
   173     public String getGlobalCompositeOperation();
   174 
   175 //    public ImageData getImageForPath(String path);
   176 
   177     public int getHeight();
   178 
   179     public int getWidth();
   180 
   181     public void setHeight(int height);
   182 
   183     public void setWidth(int width);
   184 }