c99d76e4d3b5773ab3b53cbf1c9d167cdac8c0f8
[jalviewjs.git] / site / swingjs / j2s / swingjs / JSGraphics2D.js
1 Clazz.declarePackage ("swingjs");
2 Clazz.load (["jssun.java2d.SunGraphics2D"], "swingjs.JSGraphics2D", ["java.util.HashMap", "java.awt.BasicStroke", "$.Rectangle", "$.RenderingHints", "$.Toolkit", "java.awt.geom.AffineTransform", "swingjs.JSToolkit", "swingjs.api.HTML5CanvasContext2D"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.constrainX = 0;
5 this.constrainY = 0;
6 this.windowWidth = 0;
7 this.windowHeight = 0;
8 this.canvas = null;
9 this.ctx = null;
10 this.gc = null;
11 this.paintState = 0;
12 this.compositeState = -2147483648;
13 this.strokeState = 0;
14 this.$transformState = 0;
15 this.clipState = 0;
16 this.isShifted = false;
17 this.font = null;
18 this.inPath = false;
19 this.currentClip = null;
20 Clazz.instantialize (this, arguments);
21 }, swingjs, "JSGraphics2D", jssun.java2d.SunGraphics2D, Cloneable);
22 Clazz.makeConstructor (c$, 
23 function (canvas) {
24 Clazz.superConstructor (this, swingjs.JSGraphics2D, []);
25 this.hints =  new java.awt.RenderingHints ( new java.util.HashMap ());
26 this.canvas = canvas;
27 this.ctx = this.canvas.getContext ("2d");
28 this.$transform =  new java.awt.geom.AffineTransform ();
29 {
30 this.gc = SwingJS;
31 }}, "~O");
32 Clazz.overrideMethod (c$, "getDeviceConfiguration", 
33 function () {
34 return this.gc;
35 });
36 Clazz.overrideMethod (c$, "drawLine", 
37 function (x0, y0, x1, y1) {
38 var inPath = this.inPath;
39 if (!inPath) this.ctx.beginPath ();
40 this.ctx.moveTo (x0, y0);
41 this.ctx.lineTo (x1, y1);
42 if (!inPath) this.ctx.stroke ();
43 }, "~N,~N,~N,~N");
44 Clazz.defineMethod (c$, "drawCircle", 
45 function (x, y, diameter) {
46 this.drawArc (x, y, diameter, diameter, 0, 360);
47 }, "~N,~N,~N");
48 Clazz.overrideMethod (c$, "fillArc", 
49 function (x, y, width, height, startAngle, arcAngle) {
50 this.doArc (x, y, width, height, startAngle, arcAngle, true);
51 }, "~N,~N,~N,~N,~N,~N");
52 Clazz.overrideMethod (c$, "drawArc", 
53 function (x, y, width, height, startAngle, arcAngle) {
54 this.doArc (x, y, width, height, startAngle, arcAngle, false);
55 }, "~N,~N,~N,~N,~N,~N");
56 Clazz.defineMethod (c$, "save", 
57  function () {
58 this.ctx.save ();
59 });
60 Clazz.defineMethod (c$, "restore", 
61  function () {
62 this.ctx.restore ();
63 });
64 Clazz.defineMethod (c$, "doArc", 
65  function (x, y, width, height, startAngle, arcAngle, fill) {
66 var isCircle = (arcAngle - startAngle == 360);
67 this.save ();
68 this.ctx.translate (x, y);
69 this.ctx.scale (Clazz.doubleToInt (width / height), height);
70 this.ctx.beginPath ();
71 if (fill) {
72 }this.ctx.arc (0.5, 0.5, 0.5, this.toRad (startAngle), this.toRad (arcAngle), false);
73 if (isCircle) this.ctx.closePath ();
74 this.ctx.stroke ();
75 this.restore ();
76 }, "~N,~N,~N,~N,~N,~N,~B");
77 Clazz.defineMethod (c$, "toRad", 
78  function (a) {
79 return a * 3.141592653589793 / 180;
80 }, "~N");
81 Clazz.defineMethod (c$, "drawPolygon", 
82 function (ayPoints, axPoints, nPoints) {
83 this.doPoly (ayPoints, axPoints, nPoints, false);
84 }, "~A,~A,~N");
85 Clazz.defineMethod (c$, "doPoly", 
86  function (axPoints, ayPoints, nPoints, doFill) {
87 this.ctx.beginPath ();
88 this.ctx.moveTo (axPoints[0], ayPoints[0]);
89 for (var i = 1; i < nPoints; i++) this.ctx.lineTo (axPoints[i], ayPoints[i]);
90
91 if (doFill) this.ctx.fill ();
92  else this.ctx.stroke ();
93 }, "~A,~A,~N,~B");
94 Clazz.overrideMethod (c$, "drawRect", 
95 function (x, y, width, height) {
96 this.ctx.beginPath ();
97 this.ctx.rect (x, y, width, height);
98 this.ctx.stroke ();
99 }, "~N,~N,~N,~N");
100 Clazz.defineMethod (c$, "drawString", 
101 function (s, x, y) {
102 this.ctx.fillText (s, x, y);
103 }, "~S,~N,~N");
104 Clazz.defineMethod (c$, "background", 
105 function (bgcolor) {
106 this.backgroundColor = bgcolor;
107 if (bgcolor == null) {
108 if (!this.isShifted) this.ctx.translate (-0.5, -0.5);
109 this.isShifted = true;
110 return;
111 }this.ctx.clearRect (0, 0, this.windowWidth, this.windowHeight);
112 this.setGraphicsColor (bgcolor);
113 this.fillRect (0, 0, this.windowWidth, this.windowHeight);
114 }, "java.awt.Color");
115 Clazz.defineMethod (c$, "fillCircle", 
116 function (x, y, diameter) {
117 var r = diameter / 2;
118 this.ctx.beginPath ();
119 this.ctx.arc (x + r, y + r, r, 0, 6.283185307179586, false);
120 this.ctx.fill ();
121 }, "~N,~N,~N");
122 Clazz.defineMethod (c$, "fillPolygon", 
123 function (ayPoints, axPoints, nPoints) {
124 this.doPoly (ayPoints, axPoints, nPoints, true);
125 }, "~A,~A,~N");
126 Clazz.overrideMethod (c$, "fillRect", 
127 function (x, y, width, height) {
128 this.ctx.fillRect (x, y, width, height);
129 }, "~N,~N,~N,~N");
130 Clazz.defineMethod (c$, "setGraphicsColor", 
131 function (c) {
132 var s = swingjs.JSToolkit.getCSSColor (c);
133 {
134 this.ctx.fillStyle = s; this.ctx.strokeStyle = s;
135 }}, "java.awt.Color");
136 Clazz.overrideMethod (c$, "setFont", 
137 function (font) {
138 this.font = font;
139 if (this.ctx == null) return;
140 var s = swingjs.JSToolkit.getCanvasFont (font);
141 {
142 this.ctx.font = s;
143 }}, "java.awt.Font");
144 Clazz.defineMethod (c$, "setStrokeBold", 
145 function (tf) {
146 this.setLineWidth (tf ? 2. : 1.);
147 }, "~B");
148 Clazz.defineMethod (c$, "setLineWidth", 
149  function (d) {
150 {
151 this.ctx.lineWidth = d;
152 }}, "~N");
153 Clazz.defineMethod (c$, "setWindowParameters", 
154 function (width, height) {
155 this.windowWidth = width;
156 this.windowHeight = height;
157 }, "~N,~N");
158 Clazz.defineMethod (c$, "canDoLineTo", 
159 function () {
160 return true;
161 });
162 Clazz.defineMethod (c$, "doStroke", 
163 function (isBegin) {
164 this.inPath = isBegin;
165 if (isBegin) {
166 this.ctx.beginPath ();
167 } else {
168 this.ctx.stroke ();
169 }}, "~B");
170 Clazz.defineMethod (c$, "lineTo", 
171 function (x2, y2) {
172 this.ctx.lineTo (x2, y2);
173 }, "~N,~N");
174 Clazz.overrideMethod (c$, "clip", 
175 function (s) {
176 this.doShape (s);
177 this.ctx.clip ();
178 }, "java.awt.Shape");
179 Clazz.overrideMethod (c$, "draw", 
180 function (s) {
181 this.doShape (s);
182 this.ctx.stroke ();
183 }, "java.awt.Shape");
184 Clazz.defineMethod (c$, "doShape", 
185  function (s) {
186 this.ctx.beginPath ();
187 var pts =  Clazz.newDoubleArray (6, 0);
188 var pi = s.getPathIterator (null);
189 while (!pi.isDone ()) {
190 switch (pi.currentSegment (pts)) {
191 case 0:
192 this.ctx.moveTo (pts[0], pts[1]);
193 break;
194 case 1:
195 this.ctx.lineTo (pts[0], pts[1]);
196 break;
197 case 2:
198 this.ctx.quadraticCurveTo (pts[0], pts[1], pts[2], pts[3]);
199 break;
200 case 3:
201 this.ctx.bezeierCurveTo (pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
202 break;
203 case 4:
204 this.ctx.closePath ();
205 break;
206 }
207 pi.next ();
208 }
209 return pi.getWindingRule ();
210 }, "java.awt.Shape");
211 Clazz.overrideMethod (c$, "fill", 
212 function (s) {
213 if (this.doShape (s) == 0) {
214 this.ctx.fill("evenodd");
215 } else this.ctx.fill ();
216 }, "java.awt.Shape");
217 Clazz.defineMethod (c$, "drawImage", 
218 function (img, x, y, observer) {
219 if (img != null) {
220 var imgNode = this.getImageNode (img);
221 if (imgNode != null) this.ctx.drawImage (imgNode, x, y, img.getWidth (observer), img.getHeight (observer));
222 if (observer != null) this.observe (img, observer, imgNode != null);
223 }return true;
224 }, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");
225 Clazz.defineMethod (c$, "observe", 
226  function (img, observer, isOK) {
227 observer.imageUpdate (img, (isOK ? 0 : 192), -1, -1, -1, -1);
228 }, "java.awt.Image,java.awt.image.ImageObserver,~B");
229 Clazz.defineMethod (c$, "drawImage", 
230 function (img, x, y, width, height, observer) {
231 if (img != null) {
232 var imgNode = this.getImageNode (img);
233 if (imgNode != null) this.ctx.drawImage (imgNode, x, y, width, height);
234 if (observer != null) this.observe (img, observer, imgNode != null);
235 }return true;
236 }, "java.awt.Image,~N,~N,~N,~N,java.awt.image.ImageObserver");
237 Clazz.defineMethod (c$, "drawImage", 
238 function (img, x, y, bgcolor, observer) {
239 swingjs.JSToolkit.notImplemented (null);
240 return this.drawImage (img, x, y, null);
241 }, "java.awt.Image,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
242 Clazz.defineMethod (c$, "drawImage", 
243 function (img, x, y, width, height, bgcolor, observer) {
244 swingjs.JSToolkit.notImplemented (null);
245 return this.drawImage (img, x, y, width, height, null);
246 }, "java.awt.Image,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
247 Clazz.defineMethod (c$, "drawImage", 
248 function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer) {
249 if (img != null) {
250 var imgNode = this.getImageNode (img);
251 if (imgNode != null) swingjs.api.HTML5CanvasContext2D.stretchImage (this.ctx, imgNode, sx1, sy1, sx2 - sx1, sy2 - sy1, dx1, dy1, dx2 - dx1, dy2 - dy1);
252 if (observer != null) this.observe (img, observer, imgNode != null);
253 }return true;
254 }, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.image.ImageObserver");
255 Clazz.defineMethod (c$, "getImageNode", 
256  function (img) {
257 var imgNode = null;
258 {
259 imgNode = img._imgNode || img._canvas;
260 }if (imgNode == null) imgNode = swingjs.JSToolkit.getCompositor ().createImageNode (img);
261 return imgNode;
262 }, "java.awt.Image");
263 Clazz.defineMethod (c$, "drawImage", 
264 function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer) {
265 swingjs.JSToolkit.notImplemented (null);
266 return this.drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
267 }, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
268 Clazz.defineMethod (c$, "drawImage", 
269 function (img, xform, obs) {
270 swingjs.JSToolkit.notImplemented (null);
271 return false;
272 }, "java.awt.Image,java.awt.geom.AffineTransform,java.awt.image.ImageObserver");
273 Clazz.overrideMethod (c$, "drawRenderedImage", 
274 function (img, xform) {
275 swingjs.JSToolkit.notImplemented (null);
276 }, "java.awt.image.RenderedImage,java.awt.geom.AffineTransform");
277 Clazz.overrideMethod (c$, "drawRenderableImage", 
278 function (img, xform) {
279 swingjs.JSToolkit.notImplemented (null);
280 }, "java.awt.image.renderable.RenderableImage,java.awt.geom.AffineTransform");
281 Clazz.overrideMethod (c$, "hit", 
282 function (rect, s, onStroke) {
283 swingjs.JSToolkit.notImplemented (null);
284 return false;
285 }, "java.awt.Rectangle,java.awt.Shape,~B");
286 Clazz.overrideMethod (c$, "setPaint", 
287 function (paint) {
288 swingjs.JSToolkit.notImplemented (null);
289 }, "java.awt.Paint");
290 Clazz.overrideMethod (c$, "setStroke", 
291 function (s) {
292 if (!(Clazz.instanceOf (s, java.awt.BasicStroke))) return;
293 var b = s;
294 var dash = b.getDashArray ();
295 var idash =  Clazz.newIntArray (dash == null ? 0 : dash.length, 0);
296 for (var i = idash.length; --i >= 0; ) idash[i] = Clazz.floatToInt (dash[i]);
297
298 this.ctx.setLineDash (idash);
299 this.setLineWidth (b.getLineWidth ());
300 var lineCap;
301 var lineJoin;
302 var miterLimit = -1;
303 switch (b.getEndCap ()) {
304 case 0:
305 lineCap = "butt";
306 break;
307 case 2:
308 lineCap = "square";
309 break;
310 case 1:
311 default:
312 lineCap = "round";
313 }
314 switch (b.getLineJoin ()) {
315 case 2:
316 lineJoin = "bevel";
317 break;
318 case 0:
319 lineJoin = "miter";
320 miterLimit = b.getMiterLimit ();
321 break;
322 case 1:
323 lineJoin = "round";
324 }
325 {
326 this.ctx.lineCap = lineCap; this.ctx.lineJoin = lineJoin; if
327 (miterLimit >= 0) this.ctx.miterLimit = miterLimit;
328 }}, "java.awt.Stroke");
329 Clazz.overrideMethod (c$, "setRenderingHint", 
330 function (hintKey, hintValue) {
331 this.hints.put (hintKey, hintValue);
332 }, "java.awt.RenderingHints.Key,~O");
333 Clazz.overrideMethod (c$, "getRenderingHint", 
334 function (hintKey) {
335 return this.hints.get (hintKey);
336 }, "java.awt.RenderingHints.Key");
337 Clazz.overrideMethod (c$, "setRenderingHints", 
338 function (hints) {
339 this.hints =  new java.awt.RenderingHints (hints);
340 }, "java.util.Map");
341 Clazz.overrideMethod (c$, "addRenderingHints", 
342 function (hints) {
343 for (var e, $e = hints.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.hints.put (e.getKey (), e.getValue ());
344
345 }, "java.util.Map");
346 Clazz.overrideMethod (c$, "getRenderingHints", 
347 function () {
348 return this.hints;
349 });
350 Clazz.defineMethod (c$, "translate", 
351 function (x, y) {
352 this.ctx.translate (x, y);
353 }, "~N,~N");
354 Clazz.overrideMethod (c$, "scale", 
355 function (sx, sy) {
356 this.ctx.scale (sx, sy);
357 }, "~N,~N");
358 Clazz.overrideMethod (c$, "setBackground", 
359 function (color) {
360 this.background (color);
361 }, "java.awt.Color");
362 Clazz.overrideMethod (c$, "getBackground", 
363 function () {
364 return this.backgroundColor;
365 });
366 Clazz.overrideMethod (c$, "createSwingJS", 
367 function () {
368 return this.clone ();
369 });
370 Clazz.overrideMethod (c$, "clone", 
371 function () {
372 this.save ();
373 return this.clone0 ();
374 });
375 Clazz.overrideMethod (c$, "dispose", 
376 function () {
377 if (this.compositeState >= 0) this.setComposite (null);
378 this.restore ();
379 });
380 Clazz.overrideMethod (c$, "getColor", 
381 function () {
382 return this.foregroundColor;
383 });
384 Clazz.overrideMethod (c$, "setColor", 
385 function (c) {
386 this.foregroundColor = c;
387 this.setGraphicsColor (c);
388 }, "java.awt.Color");
389 Clazz.overrideMethod (c$, "getFont", 
390 function () {
391 return this.font;
392 });
393 Clazz.defineMethod (c$, "getFontMetrics", 
394 function (f) {
395 return java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (f);
396 }, "java.awt.Font");
397 Clazz.overrideMethod (c$, "clipRect", 
398 function (x, y, width, height) {
399 this.ctx.beginPath ();
400 this.ctx.rect (x, y, width, height);
401 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
402 this.ctx.clip ();
403 }, "~N,~N,~N,~N");
404 Clazz.defineMethod (c$, "setClip", 
405 function (x, y, width, height) {
406 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
407 {
408 if (arguments.length == 1) { setClip1(x); return; }
409 }this.ctx.beginPath ();
410 this.ctx.rect (x, y, width, height);
411 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
412 this.ctx.clip ();
413 }, "~N,~N,~N,~N");
414 Clazz.defineMethod (c$, "setClip1", 
415 function (clip) {
416 this.ctx.beginPath ();
417 this.doShape (clip);
418 this.ctx.clip ();
419 }, "java.awt.Shape");
420 Clazz.overrideMethod (c$, "clearRect", 
421 function (x, y, width, height) {
422 this.ctx.clearRect (x, y, width, height);
423 }, "~N,~N,~N,~N");
424 Clazz.overrideMethod (c$, "drawPolyline", 
425 function (xPoints, yPoints, nPoints) {
426 if (nPoints < 2) return;
427 this.ctx.moveTo (xPoints[0], yPoints[0]);
428 for (var i = 1; i < nPoints; i++) {
429 this.ctx.lineTo (xPoints[i], yPoints[i]);
430 }
431 }, "~A,~A,~N");
432 Clazz.overrideMethod (c$, "copyArea", 
433 function (x, y, width, height, dx, dy) {
434 swingjs.JSToolkit.notImplemented (null);
435 }, "~N,~N,~N,~N,~N,~N");
436 Clazz.overrideMethod (c$, "drawRoundRect", 
437 function (x, y, width, height, arcWidth, arcHeight) {
438 swingjs.JSToolkit.notImplemented (null);
439 this.drawRect (x, y, width, height);
440 }, "~N,~N,~N,~N,~N,~N");
441 Clazz.overrideMethod (c$, "fillRoundRect", 
442 function (x, y, width, height, arcWidth, arcHeight) {
443 swingjs.JSToolkit.notImplemented (null);
444 this.fillRect (x, y, width, height);
445 }, "~N,~N,~N,~N,~N,~N");
446 Clazz.overrideMethod (c$, "drawOval", 
447 function (x, y, width, height) {
448 swingjs.JSToolkit.notImplemented (null);
449 }, "~N,~N,~N,~N");
450 Clazz.overrideMethod (c$, "fillOval", 
451 function (x, y, width, height) {
452 swingjs.JSToolkit.notImplemented (null);
453 }, "~N,~N,~N,~N");
454 Clazz.overrideMethod (c$, "getClip", 
455 function () {
456 swingjs.JSToolkit.notImplemented (null);
457 return null;
458 });
459 Clazz.overrideMethod (c$, "drawStringTrans", 
460 function (str, x, y) {
461 swingjs.JSToolkit.notImplemented (null);
462 }, "~S,~N,~N");
463 Clazz.defineMethod (c$, "drawString", 
464 function (iterator, x, y) {
465 swingjs.JSToolkit.notImplemented (null);
466 }, "java.text.AttributedCharacterIterator,~N,~N");
467 Clazz.overrideMethod (c$, "drawStringAttrTrans", 
468 function (iterator, x, y) {
469 swingjs.JSToolkit.notImplemented (null);
470 }, "java.text.AttributedCharacterIterator,~N,~N");
471 Clazz.overrideMethod (c$, "translateTrans", 
472 function (tx, ty) {
473 swingjs.JSToolkit.notImplemented (null);
474 }, "~N,~N");
475 Clazz.defineMethod (c$, "rotate", 
476 function (theta) {
477 swingjs.JSToolkit.notImplemented (null);
478 }, "~N");
479 Clazz.defineMethod (c$, "rotate", 
480 function (theta, x, y) {
481 swingjs.JSToolkit.notImplemented (null);
482 }, "~N,~N,~N");
483 Clazz.overrideMethod (c$, "shear", 
484 function (shx, shy) {
485 swingjs.JSToolkit.notImplemented (null);
486 }, "~N,~N");
487 Clazz.overrideMethod (c$, "transform", 
488 function (xform) {
489 swingjs.JSToolkit.notImplemented (null);
490 }, "java.awt.geom.AffineTransform");
491 Clazz.overrideMethod (c$, "setTransform", 
492 function (Tx) {
493 swingjs.JSToolkit.notImplemented (null);
494 }, "java.awt.geom.AffineTransform");
495 Clazz.overrideMethod (c$, "getTransform", 
496 function () {
497 swingjs.JSToolkit.notImplemented (null);
498 return null;
499 });
500 Clazz.defineMethod (c$, "cloneTransform", 
501 function () {
502 swingjs.JSToolkit.notImplemented (null);
503 return null;
504 });
505 Clazz.overrideMethod (c$, "getPaint", 
506 function () {
507 swingjs.JSToolkit.notImplemented (null);
508 return null;
509 });
510 Clazz.overrideMethod (c$, "getStroke", 
511 function () {
512 swingjs.JSToolkit.notImplemented (null);
513 return null;
514 });
515 Clazz.overrideMethod (c$, "getFontRenderContext", 
516 function () {
517 swingjs.JSToolkit.notImplemented (null);
518 return null;
519 });
520 Clazz.overrideMethod (c$, "setPaintMode", 
521 function () {
522 swingjs.JSToolkit.notImplemented (null);
523 });
524 Clazz.overrideMethod (c$, "setXORMode", 
525 function (c1) {
526 swingjs.JSToolkit.notImplemented (null);
527 }, "java.awt.Color");
528 Clazz.defineMethod (c$, "getClipBounds", 
529 function () {
530 var r = null;
531 {
532 if (arguments.length == 1) r = arguments[0];
533 }var clipRect = this.getClipBoundsImpl ();
534 if (r == null) {
535 r = clipRect;
536 } else {
537 r.x = clipRect.x;
538 r.y = clipRect.y;
539 r.width = clipRect.width;
540 r.height = clipRect.height;
541 }return r;
542 });
543 Clazz.defineMethod (c$, "getClipBoundsImpl", 
544  function () {
545 if (this.currentClip == null) {
546 this.currentClip =  new java.awt.Rectangle (0, 0, this.windowWidth, this.windowHeight);
547 }return this.currentClip;
548 });
549 Clazz.overrideMethod (c$, "setComposite", 
550 function (comp) {
551 var newRule = 0;
552 var isValid = (comp == null || (Clazz.instanceOf (comp, java.awt.AlphaComposite)) && (newRule = (comp).getRule ()) != this.compositeState);
553 if (!isValid) return;
554 if (swingjs.JSToolkit.setGraphicsCompositeAlpha (this, newRule)) this.compositeState = newRule;
555 }, "java.awt.Composite");
556 Clazz.defineMethod (c$, "drawImage", 
557 function (img, op, x, y) {
558 swingjs.JSToolkit.drawImageOp (this, img, op, x, y);
559 }, "java.awt.image.BufferedImage,java.awt.image.BufferedImageOp,~N,~N");
560 Clazz.defineMethod (c$, "setAlpha", 
561 function (f) {
562 {
563 this.ctx.globalAlpha = f;
564 }}, "~N");
565 Clazz.defineStatics (c$,
566 "saveLevel", 0);
567 });