X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjava%2Fawt%2FGraphics.js;fp=site%2Fswingjs%2Fj2s%2Fjava%2Fawt%2FGraphics.js;h=49e583042cc2732a705a9a6e78d8936aa323c54e;hp=a9211400f8884f2e6f5c925f857af77adad3edb2;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/java/awt/Graphics.js b/site/swingjs/j2s/java/awt/Graphics.js index a921140..49e5830 100644 --- a/site/swingjs/j2s/java/awt/Graphics.js +++ b/site/swingjs/j2s/java/awt/Graphics.js @@ -1,101 +1,101 @@ -Clazz.declarePackage ("java.awt"); -c$ = Clazz.declareType (java.awt, "Graphics"); -Clazz.makeConstructor (c$, -function () { -}); -Clazz.defineMethod (c$, "create", -function () { -return this.createSwingJS (); -}); -Clazz.defineMethod (c$, "create", -function (x, y, width, height) { -return this.create4 (x, y, width, height); -}, "~N,~N,~N,~N"); -Clazz.defineMethod (c$, "create4", -function (x, y, width, height) { -var g = this.createSwingJS (); -if (g == null) return null; -g.translate (x, y); -g.clipRect (0, 0, width, height); -return g; -}, "~N,~N,~N,~N"); -Clazz.defineMethod (c$, "getFontMetrics", -function () { -return this.getFontMetrics (this.getFont ()); -}); -Clazz.defineMethod (c$, "drawRect", -function (x, y, width, height) { -if ((width < 0) || (height < 0)) { -return; -}if (height == 0 || width == 0) { -this.drawLine (x, y, x + width, y + height); -} else { -this.drawLine (x, y, x + width - 1, y); -this.drawLine (x + width, y, x + width, y + height - 1); -this.drawLine (x + width, y + height, x + 1, y + height); -this.drawLine (x, y + height, x, y + 1); -}}, "~N,~N,~N,~N"); -Clazz.defineMethod (c$, "draw3DRect", -function (x, y, width, height, raised) { -var c = this.getColor (); -var brighter = c.brighter (); -var darker = c.darker (); -this.setColor (raised ? brighter : darker); -this.drawLine (x, y, x, y + height); -this.drawLine (x + 1, y, x + width - 1, y); -this.setColor (raised ? darker : brighter); -this.drawLine (x + 1, y + height, x + width, y + height); -this.drawLine (x + width, y, x + width, y + height - 1); -this.setColor (c); -}, "~N,~N,~N,~N,~B"); -Clazz.defineMethod (c$, "fill3DRect", -function (x, y, width, height, raised) { -var c = this.getColor (); -var brighter = c.brighter (); -var darker = c.darker (); -if (!raised) { -this.setColor (darker); -}this.fillRect (x + 1, y + 1, width - 2, height - 2); -this.setColor (raised ? brighter : darker); -this.drawLine (x, y, x, y + height - 1); -this.drawLine (x + 1, y, x + width - 2, y); -this.setColor (raised ? darker : brighter); -this.drawLine (x + 1, y + height - 1, x + width - 1, y + height - 1); -this.drawLine (x + width - 1, y, x + width - 1, y + height - 2); -this.setColor (c); -}, "~N,~N,~N,~N,~B"); -Clazz.defineMethod (c$, "drawPolygon", -function (p) { -this.drawPolygon (p.xpoints, p.ypoints, p.npoints); -}, "java.awt.Polygon"); -Clazz.defineMethod (c$, "fillPolygon", -function (p) { -this.fillPolygon (p.xpoints, p.ypoints, p.npoints); -}, "java.awt.Polygon"); -Clazz.defineMethod (c$, "drawChars", -function (data, offset, length, x, y) { -this.drawString ( String.instantialize (data, offset, length), x, y); -}, "~A,~N,~N,~N,~N"); -Clazz.defineMethod (c$, "drawBytes", -function (data, offset, length, x, y) { -this.drawString ( String.instantialize (data, 0, offset, length), x, y); -}, "~A,~N,~N,~N,~N"); -Clazz.overrideMethod (c$, "finalize", -function () { -this.dispose (); -}); -Clazz.overrideMethod (c$, "toString", -function () { -return this.getClass ().getName () + "[font=" + this.getFont () + ",color=" + this.getColor () + "]"; -}); -Clazz.defineMethod (c$, "getClipRect", -function () { -return this.getClipBounds (); -}); -Clazz.defineMethod (c$, "hitClip", -function (x, y, width, height) { -var clipRect = this.getClipBounds (); -if (clipRect == null) { -return true; -}return clipRect.intersects (x, y, width, height); -}, "~N,~N,~N,~N"); +Clazz.declarePackage ("java.awt"); +c$ = Clazz.declareType (java.awt, "Graphics"); +Clazz.makeConstructor (c$, +function () { +}); +Clazz.defineMethod (c$, "create", +function () { +return this.createSwingJS (); +}); +Clazz.defineMethod (c$, "create", +function (x, y, width, height) { +return this.create4 (x, y, width, height); +}, "~N,~N,~N,~N"); +Clazz.defineMethod (c$, "create4", +function (x, y, width, height) { +var g = this.createSwingJS (); +if (g == null) return null; +g.translate (x, y); +g.clipRect (0, 0, width, height); +return g; +}, "~N,~N,~N,~N"); +Clazz.defineMethod (c$, "getFontMetrics", +function () { +return this.getFontMetrics (this.getFont ()); +}); +Clazz.defineMethod (c$, "drawRect", +function (x, y, width, height) { +if ((width < 0) || (height < 0)) { +return; +}if (height == 0 || width == 0) { +this.drawLine (x, y, x + width, y + height); +} else { +this.drawLine (x, y, x + width - 1, y); +this.drawLine (x + width, y, x + width, y + height - 1); +this.drawLine (x + width, y + height, x + 1, y + height); +this.drawLine (x, y + height, x, y + 1); +}}, "~N,~N,~N,~N"); +Clazz.defineMethod (c$, "draw3DRect", +function (x, y, width, height, raised) { +var c = this.getColor (); +var brighter = c.brighter (); +var darker = c.darker (); +this.setColor (raised ? brighter : darker); +this.drawLine (x, y, x, y + height); +this.drawLine (x + 1, y, x + width - 1, y); +this.setColor (raised ? darker : brighter); +this.drawLine (x + 1, y + height, x + width, y + height); +this.drawLine (x + width, y, x + width, y + height - 1); +this.setColor (c); +}, "~N,~N,~N,~N,~B"); +Clazz.defineMethod (c$, "fill3DRect", +function (x, y, width, height, raised) { +var c = this.getColor (); +var brighter = c.brighter (); +var darker = c.darker (); +if (!raised) { +this.setColor (darker); +}this.fillRect (x + 1, y + 1, width - 2, height - 2); +this.setColor (raised ? brighter : darker); +this.drawLine (x, y, x, y + height - 1); +this.drawLine (x + 1, y, x + width - 2, y); +this.setColor (raised ? darker : brighter); +this.drawLine (x + 1, y + height - 1, x + width - 1, y + height - 1); +this.drawLine (x + width - 1, y, x + width - 1, y + height - 2); +this.setColor (c); +}, "~N,~N,~N,~N,~B"); +Clazz.defineMethod (c$, "drawPolygon", +function (p) { +this.drawPolygon (p.xpoints, p.ypoints, p.npoints); +}, "java.awt.Polygon"); +Clazz.defineMethod (c$, "fillPolygon", +function (p) { +this.fillPolygon (p.xpoints, p.ypoints, p.npoints); +}, "java.awt.Polygon"); +Clazz.defineMethod (c$, "drawChars", +function (data, offset, length, x, y) { +this.drawString ( String.instantialize (data, offset, length), x, y); +}, "~A,~N,~N,~N,~N"); +Clazz.defineMethod (c$, "drawBytes", +function (data, offset, length, x, y) { +this.drawString ( String.instantialize (data, 0, offset, length), x, y); +}, "~A,~N,~N,~N,~N"); +Clazz.overrideMethod (c$, "finalize", +function () { +this.dispose (); +}); +Clazz.overrideMethod (c$, "toString", +function () { +return this.getClass ().getName () + "[font=" + this.getFont () + ",color=" + this.getColor () + "]"; +}); +Clazz.defineMethod (c$, "getClipRect", +function () { +return this.getClipBounds (); +}); +Clazz.defineMethod (c$, "hitClip", +function (x, y, width, height) { +var clipRect = this.getClipBounds (); +if (clipRect == null) { +return true; +}return clipRect.intersects (x, y, width, height); +}, "~N,~N,~N,~N");