changes to canvas and graphicsenv to support additional methods fillPolygon and mergeImages
2 * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
3 * <jaroslav.tulach@apidesign.org>
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.
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
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.
18 package net.java.html.canvas.spi;
20 import net.java.html.canvas.Dimension;
21 import net.java.html.canvas.Image;
22 import net.java.html.canvas.ImageData;
23 import net.java.html.canvas.Style;
26 * Provider API for Canvas. Implement this to add support for your platform.
30 public interface GraphicsEnvironment {
32 public void arc(double centerX,
39 public void arcTo(double x1,
45 public boolean isPointInPath(double x, double y);
51 public void beginPath();
53 public void closePath();
57 public void moveTo(double x, double y);
59 public void lineTo(double x, double y);
61 public void quadraticCurveTo(double cpx, double cpy, double x, double y);
63 public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
65 public void fillRect(double x, double y, double width, double height);
67 public void strokeRect(double x, double y, double width, double height);
69 public void clearRect(double x, double y, double width, double height);
71 public void rect(double x, double y, double width, double height);
75 public void restore();
77 public void rotate(double angle);
79 public void transform(double a, double b, double c, double d, double e, double f);
81 public void setTransform(double a, double b, double c, double d, double e, double f);
83 public void translate(double x, double y);
85 public void scale(double x, double y);
87 public Object drawImage(Image image, double x, double y, Object nativeImage);
89 public Object drawImage(Image image, double x, double y, double width, double height, Object nativeImage);
91 public Object drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height, Object nativeImage);
94 public int getWidth(Image image, Object nativeImage);
96 public int getHeight(Image image, Object nativeImage);
101 * When implementing you can return an Object of your choice to enable
102 * caching. Returning null means no caching. When caching is enabled, and
103 * the cache hasn't been invalidated, the Object you returned will be passed
106 * @param style The style object you should use to create your native style
107 * @param nativeStyle your native object if cached, null otherwise
108 * @return return native Object for caching
111 public Object setFillStyle(Style style, Object nativeStyle);
114 * When implementing you can return an Object of your choice to enable
115 * caching. Returning null means no caching. When caching is enabled, and
116 * the cache hasn't been invalidated, the Object you returned will be passed
119 * @param style The style object you should use to create your native style
120 * @param nativeStyle your native object if cached, null otherwise
121 * @return return native Object for caching
124 public Object setStrokeStyle(Style style, Object nativeStyle);
126 public void setShadowColor(String color);
128 public void setShadowBlur(double blur);
130 public void setShadowOffsetX(double x);
132 public void setShadowOffsetY(double y);
134 public String getShadowColor();
136 public double getShadowBlur();
138 public double getShadowOffsetX();
140 public double getShadowOffsetY();
142 public String getLineCap();
144 public void setLineCap(String style);
146 public String getLineJoin();
148 public void setLineJoin(String style);
150 public double getLineWidth();
152 public void setLineWidth(double width);
154 public double getMiterLimit();
156 public void setMiterLimit(double limit);
158 public String getFont();
160 public void setFont(String font);
162 public String getTextAlign();
164 public void setTextAlign(String textAlign);
166 public String getTextBaseline();
168 public void setTextBaseline(String textbaseline);
170 public void fillText(String text, double x, double y);
172 public void fillText(String text, double x, double y, double maxWidth);
174 public Dimension measureText(String text);
176 public void strokeText(String text, double x, double y);
178 public void strokeText(String text, double x, double y, double maxWidth);
180 public ImageData createPixelMap(double x, double y);
182 public ImageData createPixelMap(ImageData imageData);
184 public ImageData getPixelMap(double x, double y, double width, double height);
186 public void putPixelMap(ImageData imageData, double x, double y);
188 public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
190 public void setGlobalAlpha(double alpha);
192 public double getGlobalAlpha();
194 public void setGlobalCompositeOperation(String operation);
196 public String getGlobalCompositeOperation();
198 public int getHeight();
200 public int getWidth();
202 public void setHeight(int height);
204 public void setWidth(int width);
206 public Object mergeImages(Image a, Image b, Object cachedA, Object cachedB);