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.Style;
24 * Provider API for Canvas. Implement this to add support for your platform.
28 public interface GraphicsEnvironment {
30 public void arc(double centerX,
37 public void arcTo(double x1,
43 public boolean isPointInPath(double x, double y);
49 public void beginPath();
51 public void closePath();
55 public void moveTo(double x, double y);
57 public void lineTo(double x, double y);
59 public void quadraticCurveTo(double cpx, double cpy, double x, double y);
61 public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
63 public void fillRect(double x, double y, double width, double height);
65 public void strokeRect(double x, double y, double width, double height);
67 public void clearRect(double x, double y, double width, double height);
69 public void rect(double x, double y, double width, double height);
73 public void restore();
75 public void rotate(double angle);
77 public void transform(double a, double b, double c, double d, double e, double f);
79 public void setTransform(double a, double b, double c, double d, double e, double f);
81 public void translate(double x, double y);
83 public void scale(double x, double y);
85 //// public void drawImage(ImageData image, double x, double y);
87 //// public void drawImage(ImageData image, double x, double y, double width, double height);
89 //// public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
93 * When implementing you can return an Object of your choice to enable
94 * caching. Returning null means no caching. When caching is enabled, and
95 * the cache hasn't been invalidated, the Object you returned will be passed
98 * @param style The style object you should use to create your native style
99 * @param nativeStyle your native object if cached, null otherwise
100 * @return return native Object for caching
103 public Object setFillStyle(Style style, Object nativeStyle);
106 * When implementing you can return an Object of your choice to enable
107 * caching. Returning null means no caching. When caching is enabled, and
108 * the cache hasn't been invalidated, the Object you returned will be passed
111 * @param style The style object you should use to create your native style
112 * @param nativeStyle your native object if cached, null otherwise
113 * @return return native Object for caching
116 public Object setStrokeStyle(Style style, Object nativeStyle);
118 public void setShadowColor(String color);
120 public void setShadowBlur(double blur);
122 public void setShadowOffsetX(double x);
124 public void setShadowOffsetY(double y);
126 public String getShadowColor();
128 public double getShadowBlur();
130 public double getShadowOffsetX();
132 public double getShadowOffsetY();
134 public String getLineCap();
136 public void setLineCap(String style);
138 public String getLineJoin();
140 public void setLineJoin(String style);
142 public double getLineWidth();
144 public void setLineWidth(double width);
146 public double getMiterLimit();
148 public void setMiterLimit(double limit);
150 public String getFont();
152 public void setFont(String font);
154 public String getTextAlign();
156 public void setTextAlign(String textAlign);
158 public String getTextBaseline();
160 public void setTextBaseline(String textbaseline);
162 public void fillText(String text, double x, double y);
164 public void fillText(String text, double x, double y, double maxWidth);
166 public Dimension measureText(String text);
168 public void strokeText(String text, double x, double y);
170 public void strokeText(String text, double x, double y, double maxWidth);
172 //// public ImageData createImageData(double x, double y);
174 //// public ImageData createImageData(ImageData imageData);
176 //// public ImageData getImageData(double x, double y, double width, double height);
178 //// public void putImageData(ImageData imageData, double x, double y);
180 //// public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
181 public void setGlobalAlpha(double alpha);
183 public double getGlobalAlpha();
185 public void setGlobalCompositeOperation(String operation);
187 public String getGlobalCompositeOperation();
189 //// public ImageData getImageForPath(String path);
190 public int getHeight();
192 public int getWidth();
194 public void setHeight(int height);
196 public void setWidth(int width);