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