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