javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java
author Anton Epple <toni.epple@eppleton.de>
Fri, 24 May 2013 07:36:58 +0200
branchcanvas
changeset 1137 964e42c9448d
parent 1136 591d06d8e06f
child 1141 69c81bdaf193
permissions -rw-r--r--
Added Dimension class to fix problem with TextMetrics
     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 net.java.html.canvas.Dimension;
    21 import net.java.html.canvas.Style;
    22 
    23 /**
    24  * Provider API for Canvas. Implement this to add support for your platform.
    25  * @author antonepple
    26  */
    27 public interface GraphicsEnvironment {
    28 
    29     public void arc(double centerX,
    30             double centerY,
    31             double startAngle,
    32             double radius,
    33             double endAngle,
    34             boolean ccw);
    35 
    36     public void arcTo(double x1,
    37             double y1,
    38             double x2,
    39             double y2,
    40             double r);
    41 
    42     public boolean isPointInPath(double x, double y);
    43 
    44     public void fill();
    45 
    46     public void stroke();
    47 
    48     public void beginPath();
    49 
    50     public void closePath();
    51 
    52     public void clip();
    53 
    54     public void moveTo(double x, double y);
    55 
    56     public void lineTo(double x, double y);
    57 
    58     public void quadraticCurveTo(double cpx, double cpy, double x, double y);
    59 
    60     public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
    61 
    62     public void fillRect(double x, double y, double width, double height);
    63 
    64     public void strokeRect(double x, double y, double width, double height);
    65 
    66     public void clearRect(double x, double y, double width, double height);
    67 
    68     public void rect(double x, double y, double width, double height);
    69 
    70     public void save();
    71 
    72     public void restore();
    73 
    74     public void rotate(double angle);
    75 
    76     public void transform(double a, double b, double c, double d, double e, double f);
    77 
    78     public void setTransform(double a, double b, double c, double d, double e, double f);
    79 
    80     public void translate(double x, double y);
    81 
    82     public void scale(double x, double y);
    83 
    84 ////    public void drawImage(ImageData image, double x, double y);
    85 ////
    86 ////    public void drawImage(ImageData image, double x, double y, double width, double height);
    87 ////
    88 ////    public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
    89 //
    90     public void setFillStyle(String style);
    91 
    92     public String getFillStyle();
    93 
    94     public void setFillStyle(Style style);
    95 
    96     public void setStrokeStyle(String style);
    97 
    98     public void setStrokeStyle(Style style);
    99 
   100     public void setShadowColor(String color);
   101 
   102     public void setShadowBlur(double blur);
   103 
   104     public void setShadowOffsetX(double x);
   105 
   106     public void setShadowOffsetY(double y);
   107 
   108     public String getStrokeStyle();
   109 
   110     public String getShadowColor();
   111 
   112     public double getShadowBlur();
   113 
   114     public double getShadowOffsetX();
   115 
   116     public double getShadowOffsetY();
   117 
   118     public String getLineCap();
   119 
   120     public void setLineCap(String style);
   121 
   122     public String getLineJoin();
   123 
   124     public void setLineJoin(String style);
   125 
   126     public double getLineWidth();
   127 
   128     public void setLineWidth(double width);
   129 
   130     public double getMiterLimit();
   131 
   132     public void setMiterLimit(double limit);
   133 
   134     public String getFont();
   135 
   136     public void setFont(String font);
   137 
   138     public String getTextAlign();
   139 
   140     public void setTextAlign(String textAlign);
   141 
   142     public String getTextBaseline();
   143 
   144     public void setTextBaseline(String textbaseline);
   145 
   146     public void fillText(String text, double x, double y);
   147 
   148     public void fillText(String text, double x, double y, double maxWidth);
   149 
   150     public Dimension measureText(String text);
   151 
   152     public void strokeText(String text, double x, double y);
   153 
   154     public void strokeText(String text, double x, double y, double maxWidth);
   155 
   156 ////    public ImageData createImageData(double x, double y);
   157 ////
   158 ////    public ImageData createImageData(ImageData imageData);
   159 ////
   160 ////    public ImageData getImageData(double x, double y, double width, double height);
   161 ////
   162 ////    public void putImageData(ImageData imageData, double x, double y);
   163 ////
   164 ////    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   165 
   166     public void setGlobalAlpha(double alpha);
   167 
   168     public double getGlobalAlpha();
   169 
   170     public void setGlobalCompositeOperation(String operation);
   171 
   172     public String getGlobalCompositeOperation();
   173 
   174 ////    public ImageData getImageForPath(String path);
   175 
   176     public int getHeight();
   177 
   178     public int getWidth();
   179 
   180     public void setHeight(int height);
   181 
   182     public void setWidth(int width);
   183 }