Readded Image and ImageData to have the complete API again. No need to use Data in API anymore. Added caching to Image. Image are not required to be added to the page anymore, but are created in javaScript instead.
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);
95 * When implementing you can return an Object of your choice to enable
96 * caching. Returning null means no caching. When caching is enabled, and
97 * the cache hasn't been invalidated, the Object you returned will be passed
100 * @param style The style object you should use to create your native style
101 * @param nativeStyle your native object if cached, null otherwise
102 * @return return native Object for caching
105 public Object setFillStyle(Style style, Object nativeStyle);
108 * When implementing you can return an Object of your choice to enable
109 * caching. Returning null means no caching. When caching is enabled, and
110 * the cache hasn't been invalidated, the Object you returned will be passed
113 * @param style The style object you should use to create your native style
114 * @param nativeStyle your native object if cached, null otherwise
115 * @return return native Object for caching
118 public Object setStrokeStyle(Style style, Object nativeStyle);
120 public void setShadowColor(String color);
122 public void setShadowBlur(double blur);
124 public void setShadowOffsetX(double x);
126 public void setShadowOffsetY(double y);
128 public String getShadowColor();
130 public double getShadowBlur();
132 public double getShadowOffsetX();
134 public double getShadowOffsetY();
136 public String getLineCap();
138 public void setLineCap(String style);
140 public String getLineJoin();
142 public void setLineJoin(String style);
144 public double getLineWidth();
146 public void setLineWidth(double width);
148 public double getMiterLimit();
150 public void setMiterLimit(double limit);
152 public String getFont();
154 public void setFont(String font);
156 public String getTextAlign();
158 public void setTextAlign(String textAlign);
160 public String getTextBaseline();
162 public void setTextBaseline(String textbaseline);
164 public void fillText(String text, double x, double y);
166 public void fillText(String text, double x, double y, double maxWidth);
168 public Dimension measureText(String text);
170 public void strokeText(String text, double x, double y);
172 public void strokeText(String text, double x, double y, double maxWidth);
174 public ImageData createPixelMap(double x, double y);
176 public ImageData createPixelMap(ImageData imageData);
178 public ImageData getPixelMap(double x, double y, double width, double height);
180 public void putPixelMap(ImageData imageData, double x, double y);
182 public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
184 public void setGlobalAlpha(double alpha);
186 public double getGlobalAlpha();
188 public void setGlobalCompositeOperation(String operation);
190 public String getGlobalCompositeOperation();
192 public Image getImageForPath(String path);
194 public int getHeight();
196 public int getWidth();
198 public void setHeight(int height);
200 public void setWidth(int width);