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