Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / swingjs / JSGraphics2D.js
index c657db0..c99d76e 100644 (file)
-Clazz.declarePackage ("swingjs");\r
-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
-c$ = Clazz.decorateAsClass (function () {\r
-this.constrainX = 0;\r
-this.constrainY = 0;\r
-this.windowWidth = 0;\r
-this.windowHeight = 0;\r
-this.canvas = null;\r
-this.ctx = null;\r
-this.gc = null;\r
-this.paintState = 0;\r
-this.compositeState = -2147483648;\r
-this.strokeState = 0;\r
-this.$transformState = 0;\r
-this.clipState = 0;\r
-this.isShifted = false;\r
-this.font = null;\r
-this.inPath = false;\r
-this.currentClip = null;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs, "JSGraphics2D", jssun.java2d.SunGraphics2D, Cloneable);\r
-Clazz.makeConstructor (c$, \r
-function (canvas) {\r
-Clazz.superConstructor (this, swingjs.JSGraphics2D, []);\r
-this.hints =  new java.awt.RenderingHints ( new java.util.HashMap ());\r
-this.canvas = canvas;\r
-this.ctx = this.canvas.getContext ("2d");\r
-this.$transform =  new java.awt.geom.AffineTransform ();\r
-{\r
-this.gc = SwingJS;\r
-}}, "~O");\r
-Clazz.overrideMethod (c$, "getDeviceConfiguration", \r
-function () {\r
-return this.gc;\r
-});\r
-Clazz.overrideMethod (c$, "drawLine", \r
-function (x0, y0, x1, y1) {\r
-var inPath = this.inPath;\r
-if (!inPath) this.ctx.beginPath ();\r
-this.ctx.moveTo (x0, y0);\r
-this.ctx.lineTo (x1, y1);\r
-if (!inPath) this.ctx.stroke ();\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "drawCircle", \r
-function (x, y, diameter) {\r
-this.drawArc (x, y, diameter, diameter, 0, 360);\r
-}, "~N,~N,~N");\r
-Clazz.overrideMethod (c$, "fillArc", \r
-function (x, y, width, height, startAngle, arcAngle) {\r
-this.doArc (x, y, width, height, startAngle, arcAngle, true);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "drawArc", \r
-function (x, y, width, height, startAngle, arcAngle) {\r
-this.doArc (x, y, width, height, startAngle, arcAngle, false);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "save", \r
- function () {\r
-this.ctx.save ();\r
-});\r
-Clazz.defineMethod (c$, "restore", \r
- function () {\r
-this.ctx.restore ();\r
-});\r
-Clazz.defineMethod (c$, "doArc", \r
- function (x, y, width, height, startAngle, arcAngle, fill) {\r
-var isCircle = (arcAngle - startAngle == 360);\r
-this.save ();\r
-this.ctx.translate (x, y);\r
-this.ctx.scale (Clazz.doubleToInt (width / height), height);\r
-this.ctx.beginPath ();\r
-if (fill) {\r
-}this.ctx.arc (0.5, 0.5, 0.5, this.toRad (startAngle), this.toRad (arcAngle), false);\r
-if (isCircle) this.ctx.closePath ();\r
-this.ctx.stroke ();\r
-this.restore ();\r
-}, "~N,~N,~N,~N,~N,~N,~B");\r
-Clazz.defineMethod (c$, "toRad", \r
- function (a) {\r
-return a * 3.141592653589793 / 180;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "drawPolygon", \r
-function (ayPoints, axPoints, nPoints) {\r
-this.doPoly (ayPoints, axPoints, nPoints, false);\r
-}, "~A,~A,~N");\r
-Clazz.defineMethod (c$, "doPoly", \r
- function (axPoints, ayPoints, nPoints, doFill) {\r
-this.ctx.beginPath ();\r
-this.ctx.moveTo (axPoints[0], ayPoints[0]);\r
-for (var i = 1; i < nPoints; i++) this.ctx.lineTo (axPoints[i], ayPoints[i]);\r
-\r
-if (doFill) this.ctx.fill ();\r
- else this.ctx.stroke ();\r
-}, "~A,~A,~N,~B");\r
-Clazz.overrideMethod (c$, "drawRect", \r
-function (x, y, width, height) {\r
-this.ctx.beginPath ();\r
-this.ctx.rect (x, y, width, height);\r
-this.ctx.stroke ();\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "drawString", \r
-function (s, x, y) {\r
-this.ctx.fillText (s, x, y);\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "background", \r
-function (bgcolor) {\r
-this.backgroundColor = bgcolor;\r
-if (bgcolor == null) {\r
-if (!this.isShifted) this.ctx.translate (-0.5, -0.5);\r
-this.isShifted = true;\r
-return;\r
-}this.ctx.clearRect (0, 0, this.windowWidth, this.windowHeight);\r
-this.setGraphicsColor (bgcolor);\r
-this.fillRect (0, 0, this.windowWidth, this.windowHeight);\r
-}, "java.awt.Color");\r
-Clazz.defineMethod (c$, "fillCircle", \r
-function (x, y, diameter) {\r
-var r = diameter / 2;\r
-this.ctx.beginPath ();\r
-this.ctx.arc (x + r, y + r, r, 0, 6.283185307179586, false);\r
-this.ctx.fill ();\r
-}, "~N,~N,~N");\r
-Clazz.defineMethod (c$, "fillPolygon", \r
-function (ayPoints, axPoints, nPoints) {\r
-this.doPoly (ayPoints, axPoints, nPoints, true);\r
-}, "~A,~A,~N");\r
-Clazz.overrideMethod (c$, "fillRect", \r
-function (x, y, width, height) {\r
-this.ctx.fillRect (x, y, width, height);\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "setGraphicsColor", \r
-function (c) {\r
-var s = swingjs.JSToolkit.getCSSColor (c);\r
-{\r
-this.ctx.fillStyle = s; this.ctx.strokeStyle = s;\r
-}}, "java.awt.Color");\r
-Clazz.overrideMethod (c$, "setFont", \r
-function (font) {\r
-this.font = font;\r
-if (this.ctx == null) return;\r
-var s = swingjs.JSToolkit.getCanvasFont (font);\r
-{\r
-this.ctx.font = s;\r
-}}, "java.awt.Font");\r
-Clazz.defineMethod (c$, "setStrokeBold", \r
-function (tf) {\r
-this.setLineWidth (tf ? 2. : 1.);\r
-}, "~B");\r
-Clazz.defineMethod (c$, "setLineWidth", \r
- function (d) {\r
-{\r
-this.ctx.lineWidth = d;\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "setWindowParameters", \r
-function (width, height) {\r
-this.windowWidth = width;\r
-this.windowHeight = height;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "canDoLineTo", \r
-function () {\r
-return true;\r
-});\r
-Clazz.defineMethod (c$, "doStroke", \r
-function (isBegin) {\r
-this.inPath = isBegin;\r
-if (isBegin) {\r
-this.ctx.beginPath ();\r
-} else {\r
-this.ctx.stroke ();\r
-}}, "~B");\r
-Clazz.defineMethod (c$, "lineTo", \r
-function (x2, y2) {\r
-this.ctx.lineTo (x2, y2);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "clip", \r
-function (s) {\r
-this.doShape (s);\r
-this.ctx.clip ();\r
-}, "java.awt.Shape");\r
-Clazz.overrideMethod (c$, "draw", \r
-function (s) {\r
-this.doShape (s);\r
-this.ctx.stroke ();\r
-}, "java.awt.Shape");\r
-Clazz.defineMethod (c$, "doShape", \r
- function (s) {\r
-this.ctx.beginPath ();\r
-var pts =  Clazz.newDoubleArray (6, 0);\r
-var pi = s.getPathIterator (null);\r
-while (!pi.isDone ()) {\r
-switch (pi.currentSegment (pts)) {\r
-case 0:\r
-this.ctx.moveTo (pts[0], pts[1]);\r
-break;\r
-case 1:\r
-this.ctx.lineTo (pts[0], pts[1]);\r
-break;\r
-case 2:\r
-this.ctx.quadraticCurveTo (pts[0], pts[1], pts[2], pts[3]);\r
-break;\r
-case 3:\r
-this.ctx.bezeierCurveTo (pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\r
-break;\r
-case 4:\r
-this.ctx.closePath ();\r
-break;\r
-}\r
-pi.next ();\r
-}\r
-return pi.getWindingRule ();\r
-}, "java.awt.Shape");\r
-Clazz.overrideMethod (c$, "fill", \r
-function (s) {\r
-if (this.doShape (s) == 0) {\r
-this.ctx.fill("evenodd");\r
-} else this.ctx.fill ();\r
-}, "java.awt.Shape");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, x, y, observer) {\r
-if (img != null) {\r
-var imgNode = this.getImageNode (img);\r
-if (imgNode != null) this.ctx.drawImage (imgNode, x, y, img.getWidth (observer), img.getHeight (observer));\r
-if (observer != null) this.observe (img, observer, imgNode != null);\r
-}return true;\r
-}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "observe", \r
- function (img, observer, isOK) {\r
-observer.imageUpdate (img, (isOK ? 0 : 192), -1, -1, -1, -1);\r
-}, "java.awt.Image,java.awt.image.ImageObserver,~B");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, x, y, width, height, observer) {\r
-if (img != null) {\r
-var imgNode = this.getImageNode (img);\r
-if (imgNode != null) this.ctx.drawImage (imgNode, x, y, width, height);\r
-if (observer != null) this.observe (img, observer, imgNode != null);\r
-}return true;\r
-}, "java.awt.Image,~N,~N,~N,~N,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, x, y, bgcolor, observer) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return this.drawImage (img, x, y, null);\r
-}, "java.awt.Image,~N,~N,java.awt.Color,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, x, y, width, height, bgcolor, observer) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return this.drawImage (img, x, y, width, height, null);\r
-}, "java.awt.Image,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer) {\r
-if (img != null) {\r
-var imgNode = this.getImageNode (img);\r
-if (imgNode != null) swingjs.api.HTML5CanvasContext2D.stretchImage (this.ctx, imgNode, sx1, sy1, sx2 - sx1, sy2 - sy1, dx1, dy1, dx2 - dx1, dy2 - dy1);\r
-if (observer != null) this.observe (img, observer, imgNode != null);\r
-}return true;\r
-}, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "getImageNode", \r
- function (img) {\r
-var imgNode = null;\r
-{\r
-imgNode = img._imgNode || img._canvas;\r
-}if (imgNode == null) imgNode = swingjs.JSToolkit.getCompositor ().createImageNode (img);\r
-return imgNode;\r
-}, "java.awt.Image");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return this.drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);\r
-}, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, xform, obs) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return false;\r
-}, "java.awt.Image,java.awt.geom.AffineTransform,java.awt.image.ImageObserver");\r
-Clazz.overrideMethod (c$, "drawRenderedImage", \r
-function (img, xform) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.image.RenderedImage,java.awt.geom.AffineTransform");\r
-Clazz.overrideMethod (c$, "drawRenderableImage", \r
-function (img, xform) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.image.renderable.RenderableImage,java.awt.geom.AffineTransform");\r
-Clazz.overrideMethod (c$, "hit", \r
-function (rect, s, onStroke) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return false;\r
-}, "java.awt.Rectangle,java.awt.Shape,~B");\r
-Clazz.overrideMethod (c$, "setPaint", \r
-function (paint) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.Paint");\r
-Clazz.overrideMethod (c$, "setStroke", \r
-function (s) {\r
-if (!(Clazz.instanceOf (s, java.awt.BasicStroke))) return;\r
-var b = s;\r
-var dash = b.getDashArray ();\r
-var idash =  Clazz.newIntArray (dash == null ? 0 : dash.length, 0);\r
-for (var i = idash.length; --i >= 0; ) idash[i] = Clazz.floatToInt (dash[i]);\r
-\r
-this.ctx.setLineDash (idash);\r
-this.setLineWidth (b.getLineWidth ());\r
-var lineCap;\r
-var lineJoin;\r
-var miterLimit = -1;\r
-switch (b.getEndCap ()) {\r
-case 0:\r
-lineCap = "butt";\r
-break;\r
-case 2:\r
-lineCap = "square";\r
-break;\r
-case 1:\r
-default:\r
-lineCap = "round";\r
-}\r
-switch (b.getLineJoin ()) {\r
-case 2:\r
-lineJoin = "bevel";\r
-break;\r
-case 0:\r
-lineJoin = "miter";\r
-miterLimit = b.getMiterLimit ();\r
-break;\r
-case 1:\r
-lineJoin = "round";\r
-}\r
-{\r
-this.ctx.lineCap = lineCap; this.ctx.lineJoin = lineJoin; if\r
-(miterLimit >= 0) this.ctx.miterLimit = miterLimit;\r
-}}, "java.awt.Stroke");\r
-Clazz.overrideMethod (c$, "setRenderingHint", \r
-function (hintKey, hintValue) {\r
-this.hints.put (hintKey, hintValue);\r
-}, "java.awt.RenderingHints.Key,~O");\r
-Clazz.overrideMethod (c$, "getRenderingHint", \r
-function (hintKey) {\r
-return this.hints.get (hintKey);\r
-}, "java.awt.RenderingHints.Key");\r
-Clazz.overrideMethod (c$, "setRenderingHints", \r
-function (hints) {\r
-this.hints =  new java.awt.RenderingHints (hints);\r
-}, "java.util.Map");\r
-Clazz.overrideMethod (c$, "addRenderingHints", \r
-function (hints) {\r
-for (var e, $e = hints.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.hints.put (e.getKey (), e.getValue ());\r
-\r
-}, "java.util.Map");\r
-Clazz.overrideMethod (c$, "getRenderingHints", \r
-function () {\r
-return this.hints;\r
-});\r
-Clazz.defineMethod (c$, "translate", \r
-function (x, y) {\r
-this.ctx.translate (x, y);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "scale", \r
-function (sx, sy) {\r
-this.ctx.scale (sx, sy);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "setBackground", \r
-function (color) {\r
-this.background (color);\r
-}, "java.awt.Color");\r
-Clazz.overrideMethod (c$, "getBackground", \r
-function () {\r
-return this.backgroundColor;\r
-});\r
-Clazz.overrideMethod (c$, "createSwingJS", \r
-function () {\r
-return this.clone ();\r
-});\r
-Clazz.overrideMethod (c$, "clone", \r
-function () {\r
-this.save ();\r
-return this.clone0 ();\r
-});\r
-Clazz.overrideMethod (c$, "dispose", \r
-function () {\r
-if (this.compositeState >= 0) this.setComposite (null);\r
-this.restore ();\r
-});\r
-Clazz.overrideMethod (c$, "getColor", \r
-function () {\r
-return this.foregroundColor;\r
-});\r
-Clazz.overrideMethod (c$, "setColor", \r
-function (c) {\r
-this.foregroundColor = c;\r
-this.setGraphicsColor (c);\r
-}, "java.awt.Color");\r
-Clazz.overrideMethod (c$, "getFont", \r
-function () {\r
-return this.font;\r
-});\r
-Clazz.defineMethod (c$, "getFontMetrics", \r
-function (f) {\r
-return java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (f);\r
-}, "java.awt.Font");\r
-Clazz.overrideMethod (c$, "clipRect", \r
-function (x, y, width, height) {\r
-this.ctx.beginPath ();\r
-this.ctx.rect (x, y, width, height);\r
-this.currentClip =  new java.awt.Rectangle (x, y, width, height);\r
-this.ctx.clip ();\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "setClip", \r
-function (x, y, width, height) {\r
-this.currentClip =  new java.awt.Rectangle (x, y, width, height);\r
-{\r
-if (arguments.length == 1) { setClip1(x); return; }\r
-}this.ctx.beginPath ();\r
-this.ctx.rect (x, y, width, height);\r
-this.currentClip =  new java.awt.Rectangle (x, y, width, height);\r
-this.ctx.clip ();\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "setClip1", \r
-function (clip) {\r
-this.ctx.beginPath ();\r
-this.doShape (clip);\r
-this.ctx.clip ();\r
-}, "java.awt.Shape");\r
-Clazz.overrideMethod (c$, "clearRect", \r
-function (x, y, width, height) {\r
-this.ctx.clearRect (x, y, width, height);\r
-}, "~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "drawPolyline", \r
-function (xPoints, yPoints, nPoints) {\r
-if (nPoints < 2) return;\r
-this.ctx.moveTo (xPoints[0], yPoints[0]);\r
-for (var i = 1; i < nPoints; i++) {\r
-this.ctx.lineTo (xPoints[i], yPoints[i]);\r
-}\r
-}, "~A,~A,~N");\r
-Clazz.overrideMethod (c$, "copyArea", \r
-function (x, y, width, height, dx, dy) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "drawRoundRect", \r
-function (x, y, width, height, arcWidth, arcHeight) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-this.drawRect (x, y, width, height);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "fillRoundRect", \r
-function (x, y, width, height, arcWidth, arcHeight) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-this.fillRect (x, y, width, height);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "drawOval", \r
-function (x, y, width, height) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "fillOval", \r
-function (x, y, width, height) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "getClip", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "drawStringTrans", \r
-function (str, x, y) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "drawString", \r
-function (iterator, x, y) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.text.AttributedCharacterIterator,~N,~N");\r
-Clazz.overrideMethod (c$, "drawStringAttrTrans", \r
-function (iterator, x, y) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.text.AttributedCharacterIterator,~N,~N");\r
-Clazz.overrideMethod (c$, "translateTrans", \r
-function (tx, ty) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "rotate", \r
-function (theta) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N");\r
-Clazz.defineMethod (c$, "rotate", \r
-function (theta, x, y) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N,~N");\r
-Clazz.overrideMethod (c$, "shear", \r
-function (shx, shy) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "transform", \r
-function (xform) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.geom.AffineTransform");\r
-Clazz.overrideMethod (c$, "setTransform", \r
-function (Tx) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.geom.AffineTransform");\r
-Clazz.overrideMethod (c$, "getTransform", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.defineMethod (c$, "cloneTransform", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "getPaint", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "getStroke", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "getFontRenderContext", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "setPaintMode", \r
-function () {\r
-swingjs.JSToolkit.notImplemented (null);\r
-});\r
-Clazz.overrideMethod (c$, "setXORMode", \r
-function (c1) {\r
-swingjs.JSToolkit.notImplemented (null);\r
-}, "java.awt.Color");\r
-Clazz.defineMethod (c$, "getClipBounds", \r
-function () {\r
-var r = null;\r
-{\r
-if (arguments.length == 1) r = arguments[0];\r
-}var clipRect = this.getClipBoundsImpl ();\r
-if (r == null) {\r
-r = clipRect;\r
-} else {\r
-r.x = clipRect.x;\r
-r.y = clipRect.y;\r
-r.width = clipRect.width;\r
-r.height = clipRect.height;\r
-}return r;\r
-});\r
-Clazz.defineMethod (c$, "getClipBoundsImpl", \r
- function () {\r
-if (this.currentClip == null) {\r
-this.currentClip =  new java.awt.Rectangle (0, 0, this.windowWidth, this.windowHeight);\r
-}return this.currentClip;\r
-});\r
-Clazz.overrideMethod (c$, "setComposite", \r
-function (comp) {\r
-var newRule = 0;\r
-var isValid = (comp == null || (Clazz.instanceOf (comp, java.awt.AlphaComposite)) && (newRule = (comp).getRule ()) != this.compositeState);\r
-if (!isValid) return;\r
-if (swingjs.JSToolkit.setGraphicsCompositeAlpha (this, newRule)) this.compositeState = newRule;\r
-}, "java.awt.Composite");\r
-Clazz.defineMethod (c$, "drawImage", \r
-function (img, op, x, y) {\r
-swingjs.JSToolkit.drawImageOp (this, img, op, x, y);\r
-}, "java.awt.image.BufferedImage,java.awt.image.BufferedImageOp,~N,~N");\r
-Clazz.defineMethod (c$, "setAlpha", \r
-function (f) {\r
-{\r
-this.ctx.globalAlpha = f;\r
-}}, "~N");\r
-Clazz.defineStatics (c$,\r
-"saveLevel", 0);\r
-});\r
+Clazz.declarePackage ("swingjs");
+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 () {
+c$ = Clazz.decorateAsClass (function () {
+this.constrainX = 0;
+this.constrainY = 0;
+this.windowWidth = 0;
+this.windowHeight = 0;
+this.canvas = null;
+this.ctx = null;
+this.gc = null;
+this.paintState = 0;
+this.compositeState = -2147483648;
+this.strokeState = 0;
+this.$transformState = 0;
+this.clipState = 0;
+this.isShifted = false;
+this.font = null;
+this.inPath = false;
+this.currentClip = null;
+Clazz.instantialize (this, arguments);
+}, swingjs, "JSGraphics2D", jssun.java2d.SunGraphics2D, Cloneable);
+Clazz.makeConstructor (c$, 
+function (canvas) {
+Clazz.superConstructor (this, swingjs.JSGraphics2D, []);
+this.hints =  new java.awt.RenderingHints ( new java.util.HashMap ());
+this.canvas = canvas;
+this.ctx = this.canvas.getContext ("2d");
+this.$transform =  new java.awt.geom.AffineTransform ();
+{
+this.gc = SwingJS;
+}}, "~O");
+Clazz.overrideMethod (c$, "getDeviceConfiguration", 
+function () {
+return this.gc;
+});
+Clazz.overrideMethod (c$, "drawLine", 
+function (x0, y0, x1, y1) {
+var inPath = this.inPath;
+if (!inPath) this.ctx.beginPath ();
+this.ctx.moveTo (x0, y0);
+this.ctx.lineTo (x1, y1);
+if (!inPath) this.ctx.stroke ();
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "drawCircle", 
+function (x, y, diameter) {
+this.drawArc (x, y, diameter, diameter, 0, 360);
+}, "~N,~N,~N");
+Clazz.overrideMethod (c$, "fillArc", 
+function (x, y, width, height, startAngle, arcAngle) {
+this.doArc (x, y, width, height, startAngle, arcAngle, true);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "drawArc", 
+function (x, y, width, height, startAngle, arcAngle) {
+this.doArc (x, y, width, height, startAngle, arcAngle, false);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.defineMethod (c$, "save", 
+ function () {
+this.ctx.save ();
+});
+Clazz.defineMethod (c$, "restore", 
+ function () {
+this.ctx.restore ();
+});
+Clazz.defineMethod (c$, "doArc", 
+ function (x, y, width, height, startAngle, arcAngle, fill) {
+var isCircle = (arcAngle - startAngle == 360);
+this.save ();
+this.ctx.translate (x, y);
+this.ctx.scale (Clazz.doubleToInt (width / height), height);
+this.ctx.beginPath ();
+if (fill) {
+}this.ctx.arc (0.5, 0.5, 0.5, this.toRad (startAngle), this.toRad (arcAngle), false);
+if (isCircle) this.ctx.closePath ();
+this.ctx.stroke ();
+this.restore ();
+}, "~N,~N,~N,~N,~N,~N,~B");
+Clazz.defineMethod (c$, "toRad", 
+ function (a) {
+return a * 3.141592653589793 / 180;
+}, "~N");
+Clazz.defineMethod (c$, "drawPolygon", 
+function (ayPoints, axPoints, nPoints) {
+this.doPoly (ayPoints, axPoints, nPoints, false);
+}, "~A,~A,~N");
+Clazz.defineMethod (c$, "doPoly", 
+ function (axPoints, ayPoints, nPoints, doFill) {
+this.ctx.beginPath ();
+this.ctx.moveTo (axPoints[0], ayPoints[0]);
+for (var i = 1; i < nPoints; i++) this.ctx.lineTo (axPoints[i], ayPoints[i]);
+
+if (doFill) this.ctx.fill ();
+ else this.ctx.stroke ();
+}, "~A,~A,~N,~B");
+Clazz.overrideMethod (c$, "drawRect", 
+function (x, y, width, height) {
+this.ctx.beginPath ();
+this.ctx.rect (x, y, width, height);
+this.ctx.stroke ();
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "drawString", 
+function (s, x, y) {
+this.ctx.fillText (s, x, y);
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "background", 
+function (bgcolor) {
+this.backgroundColor = bgcolor;
+if (bgcolor == null) {
+if (!this.isShifted) this.ctx.translate (-0.5, -0.5);
+this.isShifted = true;
+return;
+}this.ctx.clearRect (0, 0, this.windowWidth, this.windowHeight);
+this.setGraphicsColor (bgcolor);
+this.fillRect (0, 0, this.windowWidth, this.windowHeight);
+}, "java.awt.Color");
+Clazz.defineMethod (c$, "fillCircle", 
+function (x, y, diameter) {
+var r = diameter / 2;
+this.ctx.beginPath ();
+this.ctx.arc (x + r, y + r, r, 0, 6.283185307179586, false);
+this.ctx.fill ();
+}, "~N,~N,~N");
+Clazz.defineMethod (c$, "fillPolygon", 
+function (ayPoints, axPoints, nPoints) {
+this.doPoly (ayPoints, axPoints, nPoints, true);
+}, "~A,~A,~N");
+Clazz.overrideMethod (c$, "fillRect", 
+function (x, y, width, height) {
+this.ctx.fillRect (x, y, width, height);
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "setGraphicsColor", 
+function (c) {
+var s = swingjs.JSToolkit.getCSSColor (c);
+{
+this.ctx.fillStyle = s; this.ctx.strokeStyle = s;
+}}, "java.awt.Color");
+Clazz.overrideMethod (c$, "setFont", 
+function (font) {
+this.font = font;
+if (this.ctx == null) return;
+var s = swingjs.JSToolkit.getCanvasFont (font);
+{
+this.ctx.font = s;
+}}, "java.awt.Font");
+Clazz.defineMethod (c$, "setStrokeBold", 
+function (tf) {
+this.setLineWidth (tf ? 2. : 1.);
+}, "~B");
+Clazz.defineMethod (c$, "setLineWidth", 
+ function (d) {
+{
+this.ctx.lineWidth = d;
+}}, "~N");
+Clazz.defineMethod (c$, "setWindowParameters", 
+function (width, height) {
+this.windowWidth = width;
+this.windowHeight = height;
+}, "~N,~N");
+Clazz.defineMethod (c$, "canDoLineTo", 
+function () {
+return true;
+});
+Clazz.defineMethod (c$, "doStroke", 
+function (isBegin) {
+this.inPath = isBegin;
+if (isBegin) {
+this.ctx.beginPath ();
+} else {
+this.ctx.stroke ();
+}}, "~B");
+Clazz.defineMethod (c$, "lineTo", 
+function (x2, y2) {
+this.ctx.lineTo (x2, y2);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "clip", 
+function (s) {
+this.doShape (s);
+this.ctx.clip ();
+}, "java.awt.Shape");
+Clazz.overrideMethod (c$, "draw", 
+function (s) {
+this.doShape (s);
+this.ctx.stroke ();
+}, "java.awt.Shape");
+Clazz.defineMethod (c$, "doShape", 
+ function (s) {
+this.ctx.beginPath ();
+var pts =  Clazz.newDoubleArray (6, 0);
+var pi = s.getPathIterator (null);
+while (!pi.isDone ()) {
+switch (pi.currentSegment (pts)) {
+case 0:
+this.ctx.moveTo (pts[0], pts[1]);
+break;
+case 1:
+this.ctx.lineTo (pts[0], pts[1]);
+break;
+case 2:
+this.ctx.quadraticCurveTo (pts[0], pts[1], pts[2], pts[3]);
+break;
+case 3:
+this.ctx.bezeierCurveTo (pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
+break;
+case 4:
+this.ctx.closePath ();
+break;
+}
+pi.next ();
+}
+return pi.getWindingRule ();
+}, "java.awt.Shape");
+Clazz.overrideMethod (c$, "fill", 
+function (s) {
+if (this.doShape (s) == 0) {
+this.ctx.fill("evenodd");
+} else this.ctx.fill ();
+}, "java.awt.Shape");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, x, y, observer) {
+if (img != null) {
+var imgNode = this.getImageNode (img);
+if (imgNode != null) this.ctx.drawImage (imgNode, x, y, img.getWidth (observer), img.getHeight (observer));
+if (observer != null) this.observe (img, observer, imgNode != null);
+}return true;
+}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "observe", 
+ function (img, observer, isOK) {
+observer.imageUpdate (img, (isOK ? 0 : 192), -1, -1, -1, -1);
+}, "java.awt.Image,java.awt.image.ImageObserver,~B");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, x, y, width, height, observer) {
+if (img != null) {
+var imgNode = this.getImageNode (img);
+if (imgNode != null) this.ctx.drawImage (imgNode, x, y, width, height);
+if (observer != null) this.observe (img, observer, imgNode != null);
+}return true;
+}, "java.awt.Image,~N,~N,~N,~N,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, x, y, bgcolor, observer) {
+swingjs.JSToolkit.notImplemented (null);
+return this.drawImage (img, x, y, null);
+}, "java.awt.Image,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, x, y, width, height, bgcolor, observer) {
+swingjs.JSToolkit.notImplemented (null);
+return this.drawImage (img, x, y, width, height, null);
+}, "java.awt.Image,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer) {
+if (img != null) {
+var imgNode = this.getImageNode (img);
+if (imgNode != null) swingjs.api.HTML5CanvasContext2D.stretchImage (this.ctx, imgNode, sx1, sy1, sx2 - sx1, sy2 - sy1, dx1, dy1, dx2 - dx1, dy2 - dy1);
+if (observer != null) this.observe (img, observer, imgNode != null);
+}return true;
+}, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "getImageNode", 
+ function (img) {
+var imgNode = null;
+{
+imgNode = img._imgNode || img._canvas;
+}if (imgNode == null) imgNode = swingjs.JSToolkit.getCompositor ().createImageNode (img);
+return imgNode;
+}, "java.awt.Image");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer) {
+swingjs.JSToolkit.notImplemented (null);
+return this.drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
+}, "java.awt.Image,~N,~N,~N,~N,~N,~N,~N,~N,java.awt.Color,java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, xform, obs) {
+swingjs.JSToolkit.notImplemented (null);
+return false;
+}, "java.awt.Image,java.awt.geom.AffineTransform,java.awt.image.ImageObserver");
+Clazz.overrideMethod (c$, "drawRenderedImage", 
+function (img, xform) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.image.RenderedImage,java.awt.geom.AffineTransform");
+Clazz.overrideMethod (c$, "drawRenderableImage", 
+function (img, xform) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.image.renderable.RenderableImage,java.awt.geom.AffineTransform");
+Clazz.overrideMethod (c$, "hit", 
+function (rect, s, onStroke) {
+swingjs.JSToolkit.notImplemented (null);
+return false;
+}, "java.awt.Rectangle,java.awt.Shape,~B");
+Clazz.overrideMethod (c$, "setPaint", 
+function (paint) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.Paint");
+Clazz.overrideMethod (c$, "setStroke", 
+function (s) {
+if (!(Clazz.instanceOf (s, java.awt.BasicStroke))) return;
+var b = s;
+var dash = b.getDashArray ();
+var idash =  Clazz.newIntArray (dash == null ? 0 : dash.length, 0);
+for (var i = idash.length; --i >= 0; ) idash[i] = Clazz.floatToInt (dash[i]);
+
+this.ctx.setLineDash (idash);
+this.setLineWidth (b.getLineWidth ());
+var lineCap;
+var lineJoin;
+var miterLimit = -1;
+switch (b.getEndCap ()) {
+case 0:
+lineCap = "butt";
+break;
+case 2:
+lineCap = "square";
+break;
+case 1:
+default:
+lineCap = "round";
+}
+switch (b.getLineJoin ()) {
+case 2:
+lineJoin = "bevel";
+break;
+case 0:
+lineJoin = "miter";
+miterLimit = b.getMiterLimit ();
+break;
+case 1:
+lineJoin = "round";
+}
+{
+this.ctx.lineCap = lineCap; this.ctx.lineJoin = lineJoin; if
+(miterLimit >= 0) this.ctx.miterLimit = miterLimit;
+}}, "java.awt.Stroke");
+Clazz.overrideMethod (c$, "setRenderingHint", 
+function (hintKey, hintValue) {
+this.hints.put (hintKey, hintValue);
+}, "java.awt.RenderingHints.Key,~O");
+Clazz.overrideMethod (c$, "getRenderingHint", 
+function (hintKey) {
+return this.hints.get (hintKey);
+}, "java.awt.RenderingHints.Key");
+Clazz.overrideMethod (c$, "setRenderingHints", 
+function (hints) {
+this.hints =  new java.awt.RenderingHints (hints);
+}, "java.util.Map");
+Clazz.overrideMethod (c$, "addRenderingHints", 
+function (hints) {
+for (var e, $e = hints.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.hints.put (e.getKey (), e.getValue ());
+
+}, "java.util.Map");
+Clazz.overrideMethod (c$, "getRenderingHints", 
+function () {
+return this.hints;
+});
+Clazz.defineMethod (c$, "translate", 
+function (x, y) {
+this.ctx.translate (x, y);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "scale", 
+function (sx, sy) {
+this.ctx.scale (sx, sy);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "setBackground", 
+function (color) {
+this.background (color);
+}, "java.awt.Color");
+Clazz.overrideMethod (c$, "getBackground", 
+function () {
+return this.backgroundColor;
+});
+Clazz.overrideMethod (c$, "createSwingJS", 
+function () {
+return this.clone ();
+});
+Clazz.overrideMethod (c$, "clone", 
+function () {
+this.save ();
+return this.clone0 ();
+});
+Clazz.overrideMethod (c$, "dispose", 
+function () {
+if (this.compositeState >= 0) this.setComposite (null);
+this.restore ();
+});
+Clazz.overrideMethod (c$, "getColor", 
+function () {
+return this.foregroundColor;
+});
+Clazz.overrideMethod (c$, "setColor", 
+function (c) {
+this.foregroundColor = c;
+this.setGraphicsColor (c);
+}, "java.awt.Color");
+Clazz.overrideMethod (c$, "getFont", 
+function () {
+return this.font;
+});
+Clazz.defineMethod (c$, "getFontMetrics", 
+function (f) {
+return java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (f);
+}, "java.awt.Font");
+Clazz.overrideMethod (c$, "clipRect", 
+function (x, y, width, height) {
+this.ctx.beginPath ();
+this.ctx.rect (x, y, width, height);
+this.currentClip =  new java.awt.Rectangle (x, y, width, height);
+this.ctx.clip ();
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "setClip", 
+function (x, y, width, height) {
+this.currentClip =  new java.awt.Rectangle (x, y, width, height);
+{
+if (arguments.length == 1) { setClip1(x); return; }
+}this.ctx.beginPath ();
+this.ctx.rect (x, y, width, height);
+this.currentClip =  new java.awt.Rectangle (x, y, width, height);
+this.ctx.clip ();
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "setClip1", 
+function (clip) {
+this.ctx.beginPath ();
+this.doShape (clip);
+this.ctx.clip ();
+}, "java.awt.Shape");
+Clazz.overrideMethod (c$, "clearRect", 
+function (x, y, width, height) {
+this.ctx.clearRect (x, y, width, height);
+}, "~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "drawPolyline", 
+function (xPoints, yPoints, nPoints) {
+if (nPoints < 2) return;
+this.ctx.moveTo (xPoints[0], yPoints[0]);
+for (var i = 1; i < nPoints; i++) {
+this.ctx.lineTo (xPoints[i], yPoints[i]);
+}
+}, "~A,~A,~N");
+Clazz.overrideMethod (c$, "copyArea", 
+function (x, y, width, height, dx, dy) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "drawRoundRect", 
+function (x, y, width, height, arcWidth, arcHeight) {
+swingjs.JSToolkit.notImplemented (null);
+this.drawRect (x, y, width, height);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "fillRoundRect", 
+function (x, y, width, height, arcWidth, arcHeight) {
+swingjs.JSToolkit.notImplemented (null);
+this.fillRect (x, y, width, height);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "drawOval", 
+function (x, y, width, height) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "fillOval", 
+function (x, y, width, height) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "getClip", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.overrideMethod (c$, "drawStringTrans", 
+function (str, x, y) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "drawString", 
+function (iterator, x, y) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.text.AttributedCharacterIterator,~N,~N");
+Clazz.overrideMethod (c$, "drawStringAttrTrans", 
+function (iterator, x, y) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.text.AttributedCharacterIterator,~N,~N");
+Clazz.overrideMethod (c$, "translateTrans", 
+function (tx, ty) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N");
+Clazz.defineMethod (c$, "rotate", 
+function (theta) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N");
+Clazz.defineMethod (c$, "rotate", 
+function (theta, x, y) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N,~N");
+Clazz.overrideMethod (c$, "shear", 
+function (shx, shy) {
+swingjs.JSToolkit.notImplemented (null);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "transform", 
+function (xform) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.geom.AffineTransform");
+Clazz.overrideMethod (c$, "setTransform", 
+function (Tx) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.geom.AffineTransform");
+Clazz.overrideMethod (c$, "getTransform", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.defineMethod (c$, "cloneTransform", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.overrideMethod (c$, "getPaint", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.overrideMethod (c$, "getStroke", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.overrideMethod (c$, "getFontRenderContext", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+return null;
+});
+Clazz.overrideMethod (c$, "setPaintMode", 
+function () {
+swingjs.JSToolkit.notImplemented (null);
+});
+Clazz.overrideMethod (c$, "setXORMode", 
+function (c1) {
+swingjs.JSToolkit.notImplemented (null);
+}, "java.awt.Color");
+Clazz.defineMethod (c$, "getClipBounds", 
+function () {
+var r = null;
+{
+if (arguments.length == 1) r = arguments[0];
+}var clipRect = this.getClipBoundsImpl ();
+if (r == null) {
+r = clipRect;
+} else {
+r.x = clipRect.x;
+r.y = clipRect.y;
+r.width = clipRect.width;
+r.height = clipRect.height;
+}return r;
+});
+Clazz.defineMethod (c$, "getClipBoundsImpl", 
+ function () {
+if (this.currentClip == null) {
+this.currentClip =  new java.awt.Rectangle (0, 0, this.windowWidth, this.windowHeight);
+}return this.currentClip;
+});
+Clazz.overrideMethod (c$, "setComposite", 
+function (comp) {
+var newRule = 0;
+var isValid = (comp == null || (Clazz.instanceOf (comp, java.awt.AlphaComposite)) && (newRule = (comp).getRule ()) != this.compositeState);
+if (!isValid) return;
+if (swingjs.JSToolkit.setGraphicsCompositeAlpha (this, newRule)) this.compositeState = newRule;
+}, "java.awt.Composite");
+Clazz.defineMethod (c$, "drawImage", 
+function (img, op, x, y) {
+swingjs.JSToolkit.drawImageOp (this, img, op, x, y);
+}, "java.awt.image.BufferedImage,java.awt.image.BufferedImageOp,~N,~N");
+Clazz.defineMethod (c$, "setAlpha", 
+function (f) {
+{
+this.ctx.globalAlpha = f;
+}}, "~N");
+Clazz.defineStatics (c$,
+"saveLevel", 0);
+});