Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / 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 xxxi = img
220 xxx = this;
221 if (img != null) {
222 var imgNode = this.getImageNode (img);
223 if (imgNode != null) this.ctx.drawImage (imgNode, x, y, img.getWidth (observer), img.getHeight (observer));
224 if (observer != null) this.observe (img, observer, imgNode != null);
225 }return true;
226 }, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");
227 Clazz.defineMethod (c$, "observe", 
228  function (img, observer, isOK) {
229 observer.imageUpdate (img, (isOK ? 0 : 192), -1, -1, -1, -1);
230 }, "java.awt.Image,java.awt.image.ImageObserver,~B");
231 Clazz.defineMethod (c$, "drawImage", 
232 function (img, x, y, width, height, observer) {
233 if (img != null) {
234 var imgNode = this.getImageNode (img);
235 if (imgNode != null) this.ctx.drawImage (imgNode, x, y, width, height);
236 if (observer != null) this.observe (img, observer, imgNode != null);
237 }return true;
238 }, "java.awt.Image,~N,~N,~N,~N,java.awt.image.ImageObserver");
239 Clazz.defineMethod (c$, "drawImage", 
240 function (img, x, y, bgcolor, observer) {
241 swingjs.JSToolkit.notImplemented (null);
242 return this.drawImage (img, x, y, null);
243 }, "java.awt.Image,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
244 Clazz.defineMethod (c$, "drawImage", 
245 function (img, x, y, width, height, bgcolor, observer) {
246 swingjs.JSToolkit.notImplemented (null);
247 return this.drawImage (img, x, y, width, height, null);
248 }, "java.awt.Image,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
249 Clazz.defineMethod (c$, "drawImage", 
250 function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer) {
251 if (img != null) {
252 var imgNode = this.getImageNode (img);
253 if (imgNode != null) swingjs.api.HTML5CanvasContext2D.stretchImage (this.ctx, imgNode, sx1, sy1, sx2 - sx1, sy2 - sy1, dx1, dy1, dx2 - dx1, dy2 - dy1);
254 if (observer != null) this.observe (img, observer, imgNode != null);
255 }return true;
256 }, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.image.ImageObserver");
257 Clazz.defineMethod (c$, "getImageNode", 
258  function (img) {
259 var imgNode = null;
260 {
261 imgNode = img._imgNode || img._canvas;
262 xxxii = imgNode;
263 }if (imgNode == null) imgNode = swingjs.JSToolkit.getCompositor ().createImageNode (img);
264 return imgNode;
265 }, "java.awt.Image");
266 Clazz.defineMethod (c$, "drawImage", 
267 function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer) {
268 swingjs.JSToolkit.notImplemented (null);
269 return this.drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
270 }, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
271 Clazz.defineMethod (c$, "drawImage", 
272 function (img, xform, obs) {
273 swingjs.JSToolkit.notImplemented (null);
274 return false;
275 }, "java.awt.Image,java.awt.geom.AffineTransform,java.awt.image.ImageObserver");
276 Clazz.overrideMethod (c$, "drawRenderedImage", 
277 function (img, xform) {
278 swingjs.JSToolkit.notImplemented (null);
279 }, "java.awt.image.RenderedImage,java.awt.geom.AffineTransform");
280 Clazz.overrideMethod (c$, "drawRenderableImage", 
281 function (img, xform) {
282 swingjs.JSToolkit.notImplemented (null);
283 }, "java.awt.image.renderable.RenderableImage,java.awt.geom.AffineTransform");
284 Clazz.overrideMethod (c$, "hit", 
285 function (rect, s, onStroke) {
286 swingjs.JSToolkit.notImplemented (null);
287 return false;
288 }, "java.awt.Rectangle,java.awt.Shape,~B");
289 Clazz.overrideMethod (c$, "setPaint", 
290 function (paint) {
291 swingjs.JSToolkit.notImplemented (null);
292 }, "java.awt.Paint");
293 Clazz.overrideMethod (c$, "setStroke", 
294 function (s) {
295 if (!(Clazz.instanceOf (s, java.awt.BasicStroke))) return;
296 var b = s;
297 var dash = b.getDashArray ();
298 var idash =  Clazz.newIntArray (dash == null ? 0 : dash.length, 0);
299 for (var i = idash.length; --i >= 0; ) idash[i] = Clazz.floatToInt (dash[i]);
300
301 this.ctx.setLineDash (idash);
302 this.setLineWidth (b.getLineWidth ());
303 var lineCap;
304 var lineJoin;
305 var miterLimit = -1;
306 switch (b.getEndCap ()) {
307 case 0:
308 lineCap = "butt";
309 break;
310 case 2:
311 lineCap = "square";
312 break;
313 case 1:
314 default:
315 lineCap = "round";
316 }
317 switch (b.getLineJoin ()) {
318 case 2:
319 lineJoin = "bevel";
320 break;
321 case 0:
322 lineJoin = "miter";
323 miterLimit = b.getMiterLimit ();
324 break;
325 case 1:
326 lineJoin = "round";
327 }
328 {
329 this.ctx.lineCap = lineCap; this.ctx.lineJoin = lineJoin; if
330 (miterLimit >= 0) this.ctx.miterLimit = miterLimit;
331 }}, "java.awt.Stroke");
332 Clazz.overrideMethod (c$, "setRenderingHint", 
333 function (hintKey, hintValue) {
334 this.hints.put (hintKey, hintValue);
335 }, "java.awt.RenderingHints.Key,~O");
336 Clazz.overrideMethod (c$, "getRenderingHint", 
337 function (hintKey) {
338 return this.hints.get (hintKey);
339 }, "java.awt.RenderingHints.Key");
340 Clazz.overrideMethod (c$, "setRenderingHints", 
341 function (hints) {
342 this.hints =  new java.awt.RenderingHints (hints);
343 }, "java.util.Map");
344 Clazz.overrideMethod (c$, "addRenderingHints", 
345 function (hints) {
346 for (var e, $e = hints.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.hints.put (e.getKey (), e.getValue ());
347
348 }, "java.util.Map");
349 Clazz.overrideMethod (c$, "getRenderingHints", 
350 function () {
351 return this.hints;
352 });
353 Clazz.defineMethod (c$, "translate", 
354 function (x, y) {
355 this.ctx.translate (x, y);
356 }, "~N,~N");
357 Clazz.overrideMethod (c$, "scale", 
358 function (sx, sy) {
359 this.ctx.scale (sx, sy);
360 }, "~N,~N");
361 Clazz.overrideMethod (c$, "setBackground", 
362 function (color) {
363 this.background (color);
364 }, "java.awt.Color");
365 Clazz.overrideMethod (c$, "getBackground", 
366 function () {
367 return this.backgroundColor;
368 });
369 Clazz.overrideMethod (c$, "createSwingJS", 
370 function () {
371 return this.clone ();
372 });
373 Clazz.overrideMethod (c$, "clone", 
374 function () {
375 this.save ();
376 return this.clone0 ();
377 });
378 Clazz.overrideMethod (c$, "dispose", 
379 function () {
380 if (this.compositeState >= 0) this.setComposite (null);
381 this.restore ();
382 });
383 Clazz.overrideMethod (c$, "getColor", 
384 function () {
385 return this.foregroundColor;
386 });
387 Clazz.overrideMethod (c$, "setColor", 
388 function (c) {
389 this.foregroundColor = c;
390 this.setGraphicsColor (c);
391 }, "java.awt.Color");
392 Clazz.overrideMethod (c$, "getFont", 
393 function () {
394 return this.font;
395 });
396 Clazz.defineMethod (c$, "getFontMetrics", 
397 function (f) {
398 return java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (f);
399 }, "java.awt.Font");
400 Clazz.overrideMethod (c$, "clipRect", 
401 function (x, y, width, height) {
402 this.ctx.beginPath ();
403 this.ctx.rect (x, y, width, height);
404 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
405 this.ctx.clip ();
406 }, "~N,~N,~N,~N");
407 Clazz.defineMethod (c$, "setClip", 
408 function (x, y, width, height) {
409 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
410 {
411 if (arguments.length == 1) { setClip1(x); return; }
412 }this.ctx.beginPath ();
413 this.ctx.rect (x, y, width, height);
414 this.currentClip =  new java.awt.Rectangle (x, y, width, height);
415 this.ctx.clip ();
416 }, "~N,~N,~N,~N");
417 Clazz.defineMethod (c$, "setClip1", 
418 function (clip) {
419 this.ctx.beginPath ();
420 this.doShape (clip);
421 this.ctx.clip ();
422 }, "java.awt.Shape");
423 Clazz.overrideMethod (c$, "clearRect", 
424 function (x, y, width, height) {
425 this.ctx.clearRect (x, y, width, height);
426 }, "~N,~N,~N,~N");
427 Clazz.overrideMethod (c$, "drawPolyline", 
428 function (xPoints, yPoints, nPoints) {
429 if (nPoints < 2) return;
430 this.ctx.moveTo (xPoints[0], yPoints[0]);
431 for (var i = 1; i < nPoints; i++) {
432 this.ctx.lineTo (xPoints[i], yPoints[i]);
433 }
434 }, "~A,~A,~N");
435 Clazz.overrideMethod (c$, "copyArea", 
436 function (x, y, width, height, dx, dy) {
437 swingjs.JSToolkit.notImplemented (null);
438 }, "~N,~N,~N,~N,~N,~N");
439 Clazz.overrideMethod (c$, "drawRoundRect", 
440 function (x, y, width, height, arcWidth, arcHeight) {
441 swingjs.JSToolkit.notImplemented (null);
442 this.drawRect (x, y, width, height);
443 }, "~N,~N,~N,~N,~N,~N");
444 Clazz.overrideMethod (c$, "fillRoundRect", 
445 function (x, y, width, height, arcWidth, arcHeight) {
446 swingjs.JSToolkit.notImplemented (null);
447 this.fillRect (x, y, width, height);
448 }, "~N,~N,~N,~N,~N,~N");
449 Clazz.overrideMethod (c$, "drawOval", 
450 function (x, y, width, height) {
451 swingjs.JSToolkit.notImplemented (null);
452 }, "~N,~N,~N,~N");
453 Clazz.overrideMethod (c$, "fillOval", 
454 function (x, y, width, height) {
455 swingjs.JSToolkit.notImplemented (null);
456 }, "~N,~N,~N,~N");
457 Clazz.overrideMethod (c$, "getClip", 
458 function () {
459 swingjs.JSToolkit.notImplemented (null);
460 return null;
461 });
462 Clazz.overrideMethod (c$, "drawStringTrans", 
463 function (str, x, y) {
464 swingjs.JSToolkit.notImplemented (null);
465 }, "~S,~N,~N");
466 Clazz.defineMethod (c$, "drawString", 
467 function (iterator, x, y) {
468 swingjs.JSToolkit.notImplemented (null);
469 }, "java.text.AttributedCharacterIterator,~N,~N");
470 Clazz.overrideMethod (c$, "drawStringAttrTrans", 
471 function (iterator, x, y) {
472 swingjs.JSToolkit.notImplemented (null);
473 }, "java.text.AttributedCharacterIterator,~N,~N");
474 Clazz.overrideMethod (c$, "translateTrans", 
475 function (tx, ty) {
476 swingjs.JSToolkit.notImplemented (null);
477 }, "~N,~N");
478 Clazz.defineMethod (c$, "rotate", 
479 function (theta) {
480 swingjs.JSToolkit.notImplemented (null);
481 }, "~N");
482 Clazz.defineMethod (c$, "rotate", 
483 function (theta, x, y) {
484 swingjs.JSToolkit.notImplemented (null);
485 }, "~N,~N,~N");
486 Clazz.overrideMethod (c$, "shear", 
487 function (shx, shy) {
488 swingjs.JSToolkit.notImplemented (null);
489 }, "~N,~N");
490 Clazz.overrideMethod (c$, "transform", 
491 function (xform) {
492 swingjs.JSToolkit.notImplemented (null);
493 }, "java.awt.geom.AffineTransform");
494 Clazz.overrideMethod (c$, "setTransform", 
495 function (Tx) {
496 swingjs.JSToolkit.notImplemented (null);
497 }, "java.awt.geom.AffineTransform");
498 Clazz.overrideMethod (c$, "getTransform", 
499 function () {
500 swingjs.JSToolkit.notImplemented (null);
501 return null;
502 });
503 Clazz.defineMethod (c$, "cloneTransform", 
504 function () {
505 swingjs.JSToolkit.notImplemented (null);
506 return null;
507 });
508 Clazz.overrideMethod (c$, "getPaint", 
509 function () {
510 swingjs.JSToolkit.notImplemented (null);
511 return null;
512 });
513 Clazz.overrideMethod (c$, "getStroke", 
514 function () {
515 swingjs.JSToolkit.notImplemented (null);
516 return null;
517 });
518 Clazz.overrideMethod (c$, "getFontRenderContext", 
519 function () {
520 swingjs.JSToolkit.notImplemented (null);
521 return null;
522 });
523 Clazz.overrideMethod (c$, "setPaintMode", 
524 function () {
525 swingjs.JSToolkit.notImplemented (null);
526 });
527 Clazz.overrideMethod (c$, "setXORMode", 
528 function (c1) {
529 swingjs.JSToolkit.notImplemented (null);
530 }, "java.awt.Color");
531 Clazz.defineMethod (c$, "getClipBounds", 
532 function () {
533 var r = null;
534 {
535 if (arguments.length == 1) r = arguments[0];
536 }var clipRect = this.getClipBoundsImpl ();
537 if (r == null) {
538 r = clipRect;
539 } else {
540 r.x = clipRect.x;
541 r.y = clipRect.y;
542 r.width = clipRect.width;
543 r.height = clipRect.height;
544 }return r;
545 });
546 Clazz.defineMethod (c$, "getClipBoundsImpl", 
547  function () {
548 if (this.currentClip == null) {
549 this.currentClip =  new java.awt.Rectangle (0, 0, this.windowWidth, this.windowHeight);
550 }return this.currentClip;
551 });
552 Clazz.overrideMethod (c$, "setComposite", 
553 function (comp) {
554 var newRule = 0;
555 var isValid = (comp == null || (Clazz.instanceOf (comp, java.awt.AlphaComposite)) && (newRule = (comp).getRule ()) != this.compositeState);
556 if (!isValid) return;
557 if (swingjs.JSToolkit.setGraphicsCompositeAlpha (this, newRule)) this.compositeState = newRule;
558 }, "java.awt.Composite");
559 Clazz.defineMethod (c$, "drawImage", 
560 function (img, op, x, y) {
561 swingjs.JSToolkit.drawImageOp (this, img, op, x, y);
562 }, "java.awt.image.BufferedImage,java.awt.image.BufferedImageOp,~N,~N");
563 Clazz.defineMethod (c$, "setAlpha", 
564 function (f) {
565 {
566 this.ctx.globalAlpha = f;
567 }}, "~N");
568 Clazz.defineStatics (c$,
569 "saveLevel", 0);
570 });