toni@1129
|
1 |
/**
|
toni@1447
|
2 |
* Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
|
toni@1447
|
3 |
* <jaroslav.tulach@apidesign.org>
|
toni@1129
|
4 |
*
|
toni@1447
|
5 |
* This program is free software: you can redistribute it and/or modify it under
|
toni@1447
|
6 |
* the terms of the GNU General Public License as published by the Free Software
|
toni@1447
|
7 |
* Foundation, version 2 of the License.
|
toni@1129
|
8 |
*
|
toni@1447
|
9 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
toni@1447
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
toni@1447
|
11 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
toni@1447
|
12 |
* details.
|
toni@1129
|
13 |
*
|
toni@1447
|
14 |
* You should have received a copy of the GNU General Public License along with
|
toni@1447
|
15 |
* this program. Look for COPYING file in the top folder. If not, see
|
toni@1447
|
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@1450
|
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@1447
|
32 |
/**
|
toni@1447
|
33 |
* Adds path elements to the current path to make an arc.
|
toni@1447
|
34 |
*
|
toni@1447
|
35 |
* @param centerX the center x position of the arc.
|
toni@1447
|
36 |
* @param centerY the center y position of the arc.
|
toni@1447
|
37 |
* @param startAngle the startAngle of the arc
|
toni@1447
|
38 |
* @param radius the radius of the arc.
|
toni@1447
|
39 |
* @param endAngle the endAngle of the arc
|
toni@1447
|
40 |
* @param ccw the direction of the arc (counterclockwise)
|
toni@1447
|
41 |
*/
|
toni@1128
|
42 |
public void arc(double centerX,
|
toni@1128
|
43 |
double centerY,
|
toni@1128
|
44 |
double startAngle,
|
toni@1128
|
45 |
double radius,
|
toni@1128
|
46 |
double endAngle,
|
toni@1128
|
47 |
boolean ccw);
|
toni@1128
|
48 |
|
toni@1447
|
49 |
/**
|
toni@1447
|
50 |
* Adds segments to the current path to make an arc.
|
toni@1447
|
51 |
*
|
toni@1447
|
52 |
* @param x1 the X coordinate of the first point of the arc.
|
toni@1447
|
53 |
* @param y1 the Y coordinate of the first point of the arc.
|
toni@1447
|
54 |
* @param x2 the X coordinate of the second point of the arc.
|
toni@1447
|
55 |
* @param y2 the Y coordinate of the second point of the arc.
|
toni@1447
|
56 |
* @param radius the radius of the arc in the range {0.0-positive infinity}.
|
toni@1447
|
57 |
*/
|
toni@1128
|
58 |
public void arcTo(double x1,
|
toni@1128
|
59 |
double y1,
|
toni@1128
|
60 |
double x2,
|
toni@1128
|
61 |
double y2,
|
toni@1447
|
62 |
double radius);
|
toni@1128
|
63 |
|
toni@1447
|
64 |
/**
|
toni@1447
|
65 |
* Returns true if the the given x,y point is inside the path.
|
toni@1447
|
66 |
*
|
toni@1447
|
67 |
* @param x the X coordinate to use for the check.
|
toni@1447
|
68 |
* @param y the Y coordinate to use for the check.
|
toni@1447
|
69 |
* @return true if the point given is inside the path, false otherwise.
|
toni@1447
|
70 |
*/
|
toni@1128
|
71 |
public boolean isPointInPath(double x, double y);
|
toni@1128
|
72 |
|
toni@1447
|
73 |
/**
|
toni@1447
|
74 |
* Fills the path with the current fill paint.
|
toni@1447
|
75 |
*/
|
toni@1128
|
76 |
public void fill();
|
toni@1128
|
77 |
|
toni@1447
|
78 |
/**
|
toni@1447
|
79 |
* Strokes the path with the current stroke paint.
|
toni@1447
|
80 |
*/
|
toni@1128
|
81 |
public void stroke();
|
toni@1128
|
82 |
|
toni@1447
|
83 |
/**
|
toni@1447
|
84 |
* Starts a Path
|
toni@1447
|
85 |
*/
|
toni@1128
|
86 |
public void beginPath();
|
toni@1128
|
87 |
|
toni@1447
|
88 |
/**
|
toni@1447
|
89 |
* Closes the path.
|
toni@1447
|
90 |
*/
|
toni@1128
|
91 |
public void closePath();
|
toni@1128
|
92 |
|
toni@1447
|
93 |
/**
|
toni@1447
|
94 |
* Clips using the current path
|
toni@1447
|
95 |
*/
|
toni@1128
|
96 |
public void clip();
|
toni@1128
|
97 |
|
toni@1447
|
98 |
/**
|
toni@1447
|
99 |
* Issues a move command for the current path to the given x,y coordinate.
|
toni@1447
|
100 |
*
|
toni@1447
|
101 |
* @param x the X position for the move to command.
|
toni@1447
|
102 |
* @param y the Y position for the move to command.
|
toni@1447
|
103 |
*/
|
toni@1128
|
104 |
public void moveTo(double x, double y);
|
toni@1128
|
105 |
|
toni@1447
|
106 |
/**
|
toni@1447
|
107 |
* Adds segments to the current path to make a line at the given x,y
|
toni@1447
|
108 |
* coordinate.
|
toni@1447
|
109 |
*
|
toni@1447
|
110 |
* @param x the X coordinate of the ending point of the line.
|
toni@1447
|
111 |
* @param y the Y coordinate of the ending point of the line.
|
toni@1447
|
112 |
*/
|
toni@1128
|
113 |
public void lineTo(double x, double y);
|
toni@1128
|
114 |
|
toni@1447
|
115 |
/**
|
toni@1447
|
116 |
* Adds segments to the current path to make a quadratic curve.
|
toni@1447
|
117 |
*
|
toni@1447
|
118 |
* @param cpx the X coordinate of the control point
|
toni@1447
|
119 |
* @param cpy the Y coordinate of the control point
|
toni@1447
|
120 |
* @param x the X coordinate of the end point
|
toni@1447
|
121 |
* @param y the Y coordinate of the end point
|
toni@1447
|
122 |
*/
|
toni@1128
|
123 |
public void quadraticCurveTo(double cpx, double cpy, double x, double y);
|
toni@1128
|
124 |
|
toni@1447
|
125 |
/**
|
toni@1447
|
126 |
* Adds segments to the current path to make a cubic bezier curve.
|
toni@1447
|
127 |
*
|
toni@1447
|
128 |
* @param cp1x the X coordinate of first bezier control point.
|
toni@1447
|
129 |
* @param cp1y the Y coordinate of the first bezier control point.
|
toni@1447
|
130 |
* @param cp2x the X coordinate of the second bezier control point.
|
toni@1447
|
131 |
* @param cp2y the Y coordinate of the second bezier control point.
|
toni@1447
|
132 |
* @param x the X coordinate of the end point.
|
toni@1447
|
133 |
* @param y the Y coordinate of the end point.
|
toni@1447
|
134 |
*/
|
toni@1128
|
135 |
public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
|
toni@1128
|
136 |
|
toni@1447
|
137 |
/**
|
toni@1447
|
138 |
* Fills a rectangle using the current fill paint.
|
toni@1447
|
139 |
*
|
toni@1447
|
140 |
* @param x the X position of the upper left corner of the rectangle.
|
toni@1447
|
141 |
* @param y the Y position of the upper left corner of the rectangle.
|
toni@1447
|
142 |
* @param width the width of the rectangle.
|
toni@1447
|
143 |
* @param height the height of the rectangle.
|
toni@1447
|
144 |
*/
|
toni@1128
|
145 |
public void fillRect(double x, double y, double width, double height);
|
toni@1128
|
146 |
|
toni@1447
|
147 |
/**
|
toni@1447
|
148 |
* Strokes a rectangle using the current stroke paint.
|
toni@1447
|
149 |
*
|
toni@1447
|
150 |
* @param x the X position of the upper left corner of the rectangle.
|
toni@1447
|
151 |
* @param y the Y position of the upper left corner of the rectangle.
|
toni@1447
|
152 |
* @param width the width of the rectangle.
|
toni@1447
|
153 |
* @param height the height of the rectangle.
|
toni@1447
|
154 |
*/
|
toni@1128
|
155 |
public void strokeRect(double x, double y, double width, double height);
|
toni@1128
|
156 |
|
toni@1447
|
157 |
/**
|
toni@1447
|
158 |
* Clears a portion of the canvas with a transparent color value.
|
toni@1447
|
159 |
*
|
toni@1447
|
160 |
* @param x X position of the upper left corner of the rectangle.
|
toni@1447
|
161 |
* @param y Y position of the upper left corner of the rectangle.
|
toni@1447
|
162 |
* @param width width of the rectangle.
|
toni@1447
|
163 |
* @param height height of the rectangle.
|
toni@1447
|
164 |
*/
|
toni@1128
|
165 |
public void clearRect(double x, double y, double width, double height);
|
toni@1128
|
166 |
|
toni@1447
|
167 |
/**
|
toni@1447
|
168 |
* Clears a portion of the canvas with a transparent color value.
|
toni@1447
|
169 |
*
|
toni@1447
|
170 |
* @param x X position of the upper left corner of the rectangle.
|
toni@1447
|
171 |
* @param y Y position of the upper left corner of the rectangle.
|
toni@1447
|
172 |
* @param width width of the rectangle.
|
toni@1447
|
173 |
* @param height height of the rectangle.
|
toni@1447
|
174 |
*/
|
toni@1128
|
175 |
public void rect(double x, double y, double width, double height);
|
toni@1128
|
176 |
|
toni@1447
|
177 |
/**
|
toni@1447
|
178 |
* Saves the following attributes onto a stack.
|
toni@1447
|
179 |
* <ul>
|
toni@1447
|
180 |
* <li>Global Alpha</li>
|
toni@1447
|
181 |
* <li>Global Blend Operation</li>
|
toni@1447
|
182 |
* <li>Transform</li>
|
toni@1447
|
183 |
* <li>Fill Paint</li>
|
toni@1447
|
184 |
* <li>Stroke Paint</li>
|
toni@1447
|
185 |
* <li>Line Width</li>
|
toni@1447
|
186 |
* <li>Line Cap</li>
|
toni@1447
|
187 |
* <li>Line Join</li>
|
toni@1447
|
188 |
* <li>Miter Limit</li>
|
toni@1447
|
189 |
* <li>Number of Clip Paths</li>
|
toni@1447
|
190 |
* <li>Font</li>
|
toni@1447
|
191 |
* <li>Text Align</li>
|
toni@1447
|
192 |
* <li>Text Baseline</li>
|
toni@1447
|
193 |
* <li>Effect</li>
|
toni@1447
|
194 |
* <li>Fill Rule</li>
|
toni@1447
|
195 |
* </ul>
|
toni@1447
|
196 |
* This method does NOT alter the current state in any way. Also, not that
|
toni@1447
|
197 |
* the current path is not saved.
|
toni@1447
|
198 |
*/
|
toni@1128
|
199 |
public void save();
|
toni@1128
|
200 |
|
toni@1447
|
201 |
/**
|
toni@1447
|
202 |
* Pops the state off of the stack, setting the following attributes to
|
toni@1447
|
203 |
* their value at the time when that state was pushed onto the stack. If the
|
toni@1447
|
204 |
* stack is empty then nothing is changed.
|
toni@1447
|
205 |
*
|
toni@1447
|
206 |
* <ul>
|
toni@1447
|
207 |
* <li>Global Alpha</li>
|
toni@1447
|
208 |
* <li>Global Blend Operation</li>
|
toni@1447
|
209 |
* <li>Transform</li>
|
toni@1447
|
210 |
* <li>Fill Paint</li>
|
toni@1447
|
211 |
* <li>Stroke Paint</li>
|
toni@1447
|
212 |
* <li>Line Width</li>
|
toni@1447
|
213 |
* <li>Line Cap</li>
|
toni@1447
|
214 |
* <li>Line Join</li>
|
toni@1447
|
215 |
* <li>Miter Limit</li>
|
toni@1447
|
216 |
* <li>Number of Clip Paths</li>
|
toni@1447
|
217 |
* <li>Font</li>
|
toni@1447
|
218 |
* <li>Text Align</li>
|
toni@1447
|
219 |
* <li>Text Baseline</li>
|
toni@1447
|
220 |
* <li>Effect</li>
|
toni@1447
|
221 |
* <li>Fill Rule</li>
|
toni@1447
|
222 |
* </ul>
|
toni@1447
|
223 |
*/
|
toni@1128
|
224 |
public void restore();
|
toni@1128
|
225 |
|
toni@1447
|
226 |
/**
|
toni@1447
|
227 |
* Rotates the current transform in degrees.
|
toni@1447
|
228 |
*
|
toni@1447
|
229 |
* @param angle value in degrees to rotate the current transform.
|
toni@1447
|
230 |
*/
|
toni@1128
|
231 |
public void rotate(double angle);
|
toni@1128
|
232 |
|
toni@1447
|
233 |
/**
|
toni@1447
|
234 |
* Concatenates the input with the current transform.
|
toni@1447
|
235 |
*
|
toni@1447
|
236 |
* @param a - the X coordinate scaling element of the 3x4 matrix
|
toni@1447
|
237 |
* @param b - the Y coordinate shearing element of the 3x4 matrix
|
toni@1447
|
238 |
* @param c - the X coordinate shearing element of the 3x4 matrix
|
toni@1447
|
239 |
* @param d - the Y coordinate scaling element of the 3x4 matrix
|
toni@1447
|
240 |
* @param e - the X coordinate translation element of the 3x4 matrix
|
toni@1447
|
241 |
* @param f - the Y coordinate translation element of the 3x4 matrix
|
toni@1447
|
242 |
*/
|
toni@1128
|
243 |
public void transform(double a, double b, double c, double d, double e, double f);
|
toni@1128
|
244 |
|
toni@1447
|
245 |
/**
|
toni@1447
|
246 |
* Concatenates the input with the current transform.
|
toni@1447
|
247 |
*
|
toni@1447
|
248 |
* @param a - the X coordinate scaling element of the 3x4 matrix
|
toni@1447
|
249 |
* @param b - the Y coordinate shearing element of the 3x4 matrix
|
toni@1447
|
250 |
* @param c - the X coordinate shearing element of the 3x4 matrix
|
toni@1447
|
251 |
* @param d - the Y coordinate scaling element of the 3x4 matrix
|
toni@1447
|
252 |
* @param e - the X coordinate translation element of the 3x4 matrix
|
toni@1447
|
253 |
* @param f - the Y coordinate translation element of the 3x4 matrix
|
toni@1447
|
254 |
*/
|
toni@1128
|
255 |
public void setTransform(double a, double b, double c, double d, double e, double f);
|
toni@1128
|
256 |
|
toni@1447
|
257 |
/**
|
toni@1447
|
258 |
* Translates the current transform by x, y.
|
toni@1447
|
259 |
*
|
toni@1447
|
260 |
* @param x value to translate along the x axis.
|
toni@1447
|
261 |
* @param y value to translate along the y axis.
|
toni@1447
|
262 |
*/
|
toni@1128
|
263 |
public void translate(double x, double y);
|
toni@1128
|
264 |
|
toni@1447
|
265 |
/**
|
toni@1447
|
266 |
* Scales the current transform by x, y.
|
toni@1447
|
267 |
*
|
toni@1447
|
268 |
* @param x value to scale in the x axis.
|
toni@1447
|
269 |
* @param y value to scale in the y axis.
|
toni@1447
|
270 |
*/
|
toni@1128
|
271 |
public void scale(double x, double y);
|
toni@1128
|
272 |
|
toni@1447
|
273 |
/**
|
toni@1447
|
274 |
* Draws an image at the given x, y position using the width and height of
|
toni@1447
|
275 |
* the given image.
|
toni@1447
|
276 |
*
|
toni@1447
|
277 |
* @param image the image to be drawn.
|
toni@1447
|
278 |
* @param x the X coordinate on the destination for the upper left of the
|
toni@1447
|
279 |
* image.
|
toni@1447
|
280 |
* @param y the Y coordinate on the destination for the upper left of the
|
toni@1447
|
281 |
* image.
|
toni@1447
|
282 |
* @return the native Image for caching.
|
toni@1447
|
283 |
*/
|
toni@1302
|
284 |
public Object drawImage(Image image, double x, double y, Object nativeImage);
|
toni@1144
|
285 |
|
toni@1447
|
286 |
/**
|
toni@1447
|
287 |
* Draws an image into the given destination rectangle of the canvas. The
|
toni@1447
|
288 |
* Image is scaled to fit into the destination rectagnle.
|
toni@1447
|
289 |
*
|
toni@1447
|
290 |
* @param image the image to be drawn.
|
toni@1447
|
291 |
* @param x the X coordinate on the destination for the upper left of the
|
toni@1447
|
292 |
* image.
|
toni@1447
|
293 |
* @param y the Y coordinate on the destination for the upper left of the
|
toni@1447
|
294 |
* image.
|
toni@1447
|
295 |
* @param width the width of the destination rectangle.
|
toni@1447
|
296 |
* @param height the height of the destination rectangle.
|
toni@1447
|
297 |
* @return the native Image for caching.
|
toni@1447
|
298 |
*
|
toni@1447
|
299 |
*/
|
toni@1144
|
300 |
public Object drawImage(Image image, double x, double y, double width, double height, Object nativeImage);
|
toni@1144
|
301 |
|
toni@1447
|
302 |
/**
|
toni@1447
|
303 |
* Draws the current source rectangle of the given image to the given
|
toni@1447
|
304 |
* destination rectangle of the Canvas.
|
toni@1447
|
305 |
*
|
toni@1447
|
306 |
* @param image the image to be drawn.
|
toni@1447
|
307 |
* @param sx the source rectangle's X coordinate position.
|
toni@1447
|
308 |
* @param sy the source rectangle's Y coordinate position.
|
toni@1447
|
309 |
* @param sWidth the source rectangle's width.
|
toni@1447
|
310 |
* @param sHeight the source rectangle's height.
|
toni@1447
|
311 |
* @param x the destination rectangle's X coordinate position.
|
toni@1447
|
312 |
* @param y the destination rectangle's Y coordinate position.
|
toni@1447
|
313 |
* @param width the destination rectangle's width.
|
toni@1447
|
314 |
* @param height the destination rectangle's height.
|
toni@1447
|
315 |
* @return the native Image for caching.
|
toni@1447
|
316 |
*/
|
toni@1144
|
317 |
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
|
318 |
|
toni@1447
|
319 |
/**
|
toni@1447
|
320 |
* Get the width of this Image
|
toni@1447
|
321 |
*
|
toni@1447
|
322 |
* @param image the image to measure
|
toni@1447
|
323 |
* @param nativeImage the cached native Image or null
|
toni@1447
|
324 |
* @return the width of the image
|
toni@1447
|
325 |
*/
|
toni@1263
|
326 |
public int getWidth(Image image, Object nativeImage);
|
toni@1302
|
327 |
|
toni@1447
|
328 |
/**
|
toni@1447
|
329 |
* Get the height of this Image
|
toni@1447
|
330 |
*
|
toni@1447
|
331 |
* @param image the image to measure
|
toni@1447
|
332 |
* @param nativeImage the cached native Image or null
|
toni@1447
|
333 |
* @return the height of the image
|
toni@1447
|
334 |
*/
|
toni@1263
|
335 |
public int getHeight(Image image, Object nativeImage);
|
toni@1302
|
336 |
|
toni@1141
|
337 |
/**
|
toni@1141
|
338 |
* When implementing you can return an Object of your choice to enable
|
toni@1141
|
339 |
* caching. Returning null means no caching. When caching is enabled, and
|
toni@1141
|
340 |
* the cache hasn't been invalidated, the Object you returned will be passed
|
toni@1141
|
341 |
* as a parameter.
|
toni@1141
|
342 |
*
|
toni@1141
|
343 |
* @param style The style object you should use to create your native style
|
toni@1141
|
344 |
* @param nativeStyle your native object if cached, null otherwise
|
toni@1141
|
345 |
* @return return native Object for caching
|
toni@1141
|
346 |
*
|
toni@1141
|
347 |
*/
|
toni@1141
|
348 |
public Object setFillStyle(Style style, Object nativeStyle);
|
toni@1128
|
349 |
|
toni@1141
|
350 |
/**
|
toni@1141
|
351 |
* When implementing you can return an Object of your choice to enable
|
toni@1141
|
352 |
* caching. Returning null means no caching. When caching is enabled, and
|
toni@1141
|
353 |
* the cache hasn't been invalidated, the Object you returned will be passed
|
toni@1141
|
354 |
* as a parameter.
|
toni@1141
|
355 |
*
|
toni@1141
|
356 |
* @param style The style object you should use to create your native style
|
toni@1141
|
357 |
* @param nativeStyle your native object if cached, null otherwise
|
toni@1141
|
358 |
* @return return native Object for caching
|
toni@1141
|
359 |
*
|
toni@1141
|
360 |
*/
|
toni@1141
|
361 |
public Object setStrokeStyle(Style style, Object nativeStyle);
|
toni@1128
|
362 |
|
toni@1302
|
363 |
// public void setShadowColor(String color);
|
toni@1302
|
364 |
//
|
toni@1302
|
365 |
// public void setShadowBlur(double blur);
|
toni@1302
|
366 |
//
|
toni@1302
|
367 |
// public void setShadowOffsetX(double x);
|
toni@1302
|
368 |
//
|
toni@1302
|
369 |
// public void setShadowOffsetY(double y);
|
toni@1302
|
370 |
//
|
toni@1302
|
371 |
// public String getShadowColor();
|
toni@1302
|
372 |
//
|
toni@1302
|
373 |
// public double getShadowBlur();
|
toni@1302
|
374 |
//
|
toni@1302
|
375 |
// public double getShadowOffsetX();
|
toni@1302
|
376 |
//
|
toni@1302
|
377 |
// public double getShadowOffsetY();
|
toni@1302
|
378 |
/**
|
toni@1302
|
379 |
* Gets the current stroke line cap.
|
toni@1302
|
380 |
*
|
toni@1302
|
381 |
* @return {@code StrokeLineCap} with a value of Butt, Round, or Square.
|
toni@1302
|
382 |
*/
|
toni@1128
|
383 |
public String getLineCap();
|
toni@1128
|
384 |
|
toni@1302
|
385 |
/**
|
toni@1302
|
386 |
* Sets the current stroke line cap.
|
toni@1302
|
387 |
*
|
toni@1302
|
388 |
* @param style a value of Butt, Round, or Square.
|
toni@1302
|
389 |
*/
|
toni@1128
|
390 |
public void setLineCap(String style);
|
toni@1128
|
391 |
|
toni@1302
|
392 |
/**
|
toni@1302
|
393 |
* Gets the current stroke line join.
|
toni@1302
|
394 |
*
|
toni@1302
|
395 |
* @return a value of Miter, Bevel, or Round.
|
toni@1302
|
396 |
*/
|
toni@1128
|
397 |
public String getLineJoin();
|
toni@1128
|
398 |
|
toni@1302
|
399 |
/**
|
toni@1302
|
400 |
* Sets the current stroke line join.
|
toni@1302
|
401 |
*
|
toni@1302
|
402 |
* @param style with a value of Miter, Bevel, or Round.
|
toni@1302
|
403 |
*/
|
toni@1128
|
404 |
public void setLineJoin(String style);
|
toni@1128
|
405 |
|
toni@1302
|
406 |
/**
|
toni@1302
|
407 |
* Gets the current line width.
|
toni@1302
|
408 |
*
|
toni@1302
|
409 |
* @return value between 0 and infinity.
|
toni@1302
|
410 |
*/
|
toni@1128
|
411 |
public double getLineWidth();
|
toni@1128
|
412 |
|
toni@1302
|
413 |
/**
|
toni@1302
|
414 |
* Sets the current line width.
|
toni@1302
|
415 |
*
|
toni@1302
|
416 |
* @param width value in the range {0-positive infinity}, with any other
|
toni@1302
|
417 |
* value being ignored and leaving the value unchanged.
|
toni@1302
|
418 |
*/
|
toni@1128
|
419 |
public void setLineWidth(double width);
|
toni@1128
|
420 |
|
toni@1302
|
421 |
/**
|
toni@1302
|
422 |
* Gets the current miter limit. v
|
toni@1302
|
423 |
*
|
toni@1302
|
424 |
* @return the miter limit value in the range {@code 0.0-positive infinity}
|
toni@1302
|
425 |
*/
|
toni@1128
|
426 |
public double getMiterLimit();
|
toni@1128
|
427 |
|
toni@1302
|
428 |
/**
|
toni@1302
|
429 |
* Sets the current miter limit.
|
toni@1302
|
430 |
*
|
toni@1302
|
431 |
* @param limit miter limit value between 0 and positive infinity with any
|
toni@1302
|
432 |
* other value being ignored and leaving the value unchanged.
|
toni@1302
|
433 |
*/
|
toni@1128
|
434 |
public void setMiterLimit(double limit);
|
toni@1128
|
435 |
|
toni@1302
|
436 |
/**
|
toni@1302
|
437 |
* Gets the current Font.
|
toni@1302
|
438 |
*
|
toni@1302
|
439 |
* @return the Font
|
toni@1302
|
440 |
*/
|
toni@1128
|
441 |
public String getFont();
|
toni@1128
|
442 |
|
toni@1302
|
443 |
/**
|
toni@1302
|
444 |
* Sets the current Font.
|
toni@1302
|
445 |
*
|
toni@1302
|
446 |
*/
|
toni@1128
|
447 |
public void setFont(String font);
|
toni@1128
|
448 |
|
toni@1302
|
449 |
/**
|
toni@1302
|
450 |
* Gets the current {@code TextAlignment}.
|
toni@1302
|
451 |
*
|
toni@1302
|
452 |
* @return TextAlignment with values of Left, Center, Right, or Justify.
|
toni@1302
|
453 |
*/
|
toni@1128
|
454 |
public String getTextAlign();
|
toni@1128
|
455 |
|
toni@1302
|
456 |
/**
|
toni@1302
|
457 |
* Defines horizontal text alignment, relative to the text origin.
|
toni@1302
|
458 |
*
|
toni@1302
|
459 |
* @param textAlign with values of Left, Center, Right.
|
toni@1302
|
460 |
*/
|
toni@1128
|
461 |
public void setTextAlign(String textAlign);
|
toni@1128
|
462 |
|
toni@1302
|
463 |
/**
|
toni@1302
|
464 |
* Sets the current Text Baseline.
|
toni@1302
|
465 |
*
|
toni@1302
|
466 |
* @param baseline with values of Top, Center, Baseline, or Bottom
|
toni@1302
|
467 |
*/
|
toni@1128
|
468 |
public String getTextBaseline();
|
toni@1128
|
469 |
|
toni@1302
|
470 |
/**
|
toni@1302
|
471 |
* Sets the current Text Baseline.
|
toni@1302
|
472 |
*
|
toni@1302
|
473 |
* @param baseline with values of Top, Center, Baseline, or Bottom
|
toni@1302
|
474 |
*/
|
toni@1302
|
475 |
public void setTextBaseline(String baseline);
|
toni@1128
|
476 |
|
toni@1302
|
477 |
/**
|
toni@1302
|
478 |
* Fills the given string of text at position x, y (0,0 at top left) with
|
toni@1302
|
479 |
* the current fill paint attribute.
|
toni@1302
|
480 |
*
|
toni@1302
|
481 |
* @param text the string of text.
|
toni@1302
|
482 |
* @param x position on the x axis.
|
toni@1302
|
483 |
* @param y position on the y axis.
|
toni@1302
|
484 |
*/
|
toni@1128
|
485 |
public void fillText(String text, double x, double y);
|
toni@1128
|
486 |
|
toni@1302
|
487 |
/**
|
toni@1302
|
488 |
* Fills text and includes a maximum width of the string.
|
toni@1302
|
489 |
*
|
toni@1302
|
490 |
* If the width of the text extends past max width, then it will be sized to
|
toni@1302
|
491 |
* fit.
|
toni@1302
|
492 |
*
|
toni@1302
|
493 |
* @param text the string of text.
|
toni@1302
|
494 |
* @param x position on the x axis.
|
toni@1302
|
495 |
* @param y position on the y axis.
|
toni@1302
|
496 |
* @param maxWidth maximum width the text string can have.
|
toni@1302
|
497 |
*/
|
toni@1128
|
498 |
public void fillText(String text, double x, double y, double maxWidth);
|
toni@1128
|
499 |
|
toni@1302
|
500 |
/**
|
toni@1302
|
501 |
* The Dimension of this text using the current Font settings
|
toni@1302
|
502 |
*
|
toni@1302
|
503 |
* @param text
|
toni@1302
|
504 |
* @return the Dimension of this text using the current Font settings
|
toni@1302
|
505 |
*/
|
toni@1128
|
506 |
public Dimension measureText(String text);
|
toni@1128
|
507 |
|
toni@1302
|
508 |
/**
|
toni@1302
|
509 |
* draws the given string of text at position x, y (0,0 at top left) with
|
toni@1302
|
510 |
* the current stroke paint attribute.
|
toni@1302
|
511 |
*
|
toni@1302
|
512 |
* @param text the string of text.
|
toni@1302
|
513 |
* @param x position on the x axis.
|
toni@1302
|
514 |
* @param y position on the y axis.
|
toni@1302
|
515 |
*/
|
toni@1128
|
516 |
public void strokeText(String text, double x, double y);
|
toni@1128
|
517 |
|
toni@1302
|
518 |
/**
|
toni@1302
|
519 |
* Draws text with stroke paint and includes a maximum width of the string.
|
toni@1302
|
520 |
*
|
toni@1302
|
521 |
* If the width of the text extends past max width, then it will be sized to
|
toni@1302
|
522 |
* fit.
|
toni@1302
|
523 |
*
|
toni@1302
|
524 |
* @param text the string of text.
|
toni@1302
|
525 |
* @param x position on the x axis.
|
toni@1302
|
526 |
* @param y position on the y axis.
|
toni@1302
|
527 |
* @param maxWidth maximum width the text string can have.
|
toni@1302
|
528 |
*/
|
toni@1128
|
529 |
public void strokeText(String text, double x, double y, double maxWidth);
|
toni@1128
|
530 |
|
toni@1450
|
531 |
/**
|
toni@1450
|
532 |
* Get a pixel array that you can manipulate, e.g. apply effects / transparency
|
toni@1450
|
533 |
* @param x width
|
toni@1450
|
534 |
* @param y height
|
toni@1450
|
535 |
* @return a PixelMap
|
toni@1450
|
536 |
*/
|
toni@1450
|
537 |
public ImageData createPixelMap(double x, double y);
|
toni@1450
|
538 |
|
toni@1450
|
539 |
/**
|
toni@1450
|
540 |
* Create a new ImageData object with the same dimensions as the
|
toni@1450
|
541 |
* object specified by imageData (this does not copy the image data)
|
toni@1450
|
542 |
* @param imageData
|
toni@1450
|
543 |
* @return
|
toni@1450
|
544 |
*/
|
toni@1450
|
545 |
public ImageData createPixelMap(ImageData imageData);
|
toni@1450
|
546 |
|
toni@1450
|
547 |
/**
|
toni@1450
|
548 |
* Get the pixels for a region of your GraphicsContext
|
toni@1450
|
549 |
* @param x start x coordinate
|
toni@1450
|
550 |
* @param y start y coordinate
|
toni@1450
|
551 |
* @param width width
|
toni@1450
|
552 |
* @param height height
|
toni@1450
|
553 |
* @return
|
toni@1450
|
554 |
*/
|
toni@1450
|
555 |
public ImageData getPixelMap(double x, double y, double width, double height);
|
toni@1450
|
556 |
|
toni@1450
|
557 |
/**
|
toni@1450
|
558 |
* Render an ImageData Object at the specified position
|
toni@1450
|
559 |
* @param imageData the Pixel array
|
toni@1450
|
560 |
* @param x start x coordinate
|
toni@1450
|
561 |
* @param y start y coordinate
|
toni@1450
|
562 |
*/
|
toni@1450
|
563 |
public void putPixelMap(ImageData imageData, double x, double y);
|
toni@1450
|
564 |
|
toni@1450
|
565 |
/**
|
toni@1450
|
566 |
* Render an ImageData Object at the specified position
|
toni@1450
|
567 |
* @param imageData the Pixel array to draw
|
toni@1450
|
568 |
* @param x start x coordinate
|
toni@1450
|
569 |
* @param y start y coordinate
|
toni@1450
|
570 |
* @param dirtyx The horizontal (x) value, in pixels, where to place the image on the canvas
|
toni@1450
|
571 |
* @param dirtyy The vertical (y) value, in pixels, where to place the image on the canvas
|
toni@1450
|
572 |
* @param dirtywidth The width to use to draw the image on the canvas
|
toni@1450
|
573 |
* @param dirtyheight The height to use to draw the image on the canvas
|
toni@1450
|
574 |
*/
|
toni@1450
|
575 |
public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
|
toni@1302
|
576 |
/**
|
toni@1302
|
577 |
* Sets the global alpha of the current state.
|
toni@1302
|
578 |
*
|
toni@1302
|
579 |
* @param alpha value in the range {@code 0.0-1.0}. The value is clamped if
|
toni@1302
|
580 |
* it is out of range.
|
toni@1302
|
581 |
*/
|
toni@1128
|
582 |
public void setGlobalAlpha(double alpha);
|
toni@1128
|
583 |
|
toni@1447
|
584 |
/**
|
toni@1447
|
585 |
* Get the global alpha of the current state.
|
toni@1447
|
586 |
*
|
toni@1447
|
587 |
* @return alpha value in the range {@code 0.0-1.0}.
|
toni@1447
|
588 |
*/
|
toni@1128
|
589 |
public double getGlobalAlpha();
|
toni@1128
|
590 |
|
toni@1447
|
591 |
/**
|
toni@1447
|
592 |
* Sets the global blend mode.
|
toni@1447
|
593 |
*
|
toni@1447
|
594 |
* @param operation the BlendMode that will be set.
|
toni@1447
|
595 |
*/
|
toni@1128
|
596 |
public void setGlobalCompositeOperation(String operation);
|
toni@1128
|
597 |
|
toni@1447
|
598 |
/**
|
toni@1447
|
599 |
* Gets the global blend mode.
|
toni@1447
|
600 |
*
|
toni@1447
|
601 |
* @return the global BlendMode of the current state.
|
toni@1447
|
602 |
*/
|
toni@1128
|
603 |
public String getGlobalCompositeOperation();
|
toni@1302
|
604 |
|
toni@1447
|
605 |
/**
|
toni@1447
|
606 |
* Get the height of this GraphicsContext (which should be the same as the
|
toni@1447
|
607 |
* enclosing canvas height)
|
toni@1447
|
608 |
*
|
toni@1447
|
609 |
* @return the height of this GraphicsContext
|
toni@1447
|
610 |
*/
|
toni@1128
|
611 |
public int getHeight();
|
toni@1128
|
612 |
|
toni@1447
|
613 |
/**
|
toni@1447
|
614 |
* Get the width of this GraphicsContext (which should be the same as the
|
toni@1447
|
615 |
* enclosing canvas height)
|
toni@1447
|
616 |
*
|
toni@1447
|
617 |
* @return the width of this GraphicsContext
|
toni@1447
|
618 |
*/
|
toni@1128
|
619 |
public int getWidth();
|
toni@1128
|
620 |
|
toni@1302
|
621 |
// public void setHeight(int height);
|
toni@1302
|
622 |
//
|
toni@1302
|
623 |
// public void setWidth(int width);
|
toni@1447
|
624 |
/**
|
toni@1447
|
625 |
* Merges two images drawing one on top of the other and returning the
|
toni@1447
|
626 |
* result.
|
toni@1447
|
627 |
*
|
toni@1447
|
628 |
* @param a the lower Image
|
toni@1447
|
629 |
* @param b the upper Image
|
toni@1447
|
630 |
* @param cachedA the native cached Image, if available, or null.
|
toni@1447
|
631 |
* @param cachedB the native cached Image, if available, or null.
|
toni@1447
|
632 |
* @return
|
toni@1447
|
633 |
*/
|
toni@1263
|
634 |
public Object mergeImages(Image a, Image b, Object cachedA, Object cachedB);
|
toni@1128
|
635 |
}
|