Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / swingjs / JSImage.js
index db7a9a8..ebc0cde 100644 (file)
@@ -1,59 +1,59 @@
-Clazz.declarePackage ("swingjs");\r
-Clazz.load (["java.awt.image.BufferedImage"], "swingjs.JSImage", ["JU.Base64", "swingjs.api.DOMNode"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.typeRequested = 0;\r
-this.pix = null;\r
-this._imgNode = null;\r
-this.width = 0;\r
-this.height = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs, "JSImage", java.awt.image.BufferedImage);\r
-Clazz.makeConstructor (c$, \r
-function (argb, width, height) {\r
-Clazz.superConstructor (this, swingjs.JSImage, [width, height, 2]);\r
-this.width = width;\r
-this.height = height;\r
-this.pix = argb;\r
-}, "~A,~N,~N");\r
-Clazz.defineMethod (c$, "toIntARGB", \r
-function (imgData) {\r
-var n = Clazz.doubleToInt (imgData.length / 4);\r
-var iData =  Clazz.newIntArray (n, 0);\r
-for (var i = 0, j = 0; i < n; j++) iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | 0xFF000000;\r
-\r
-return iData;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "getDOMImage", \r
-function (b, type) {\r
-var dataurl = "data:image/" + type + ";base64," + JU.Base64.getBase64 (b).toString ();\r
-var me = this;\r
-var img = null;\r
-{\r
-img = new Image(this.width, this.height);\r
-//img.onLoad = function() { me.setDOMImage(img); };\r
-img.src = dataurl;\r
-}this.setDOMImage (img);\r
-}, "~A,~S");\r
-Clazz.defineMethod (c$, "setDOMImage", \r
-function (img) {\r
-var canvas = swingjs.api.DOMNode.createElement ("canvas", "JSImage");\r
-var w = this.width;\r
-var h = this.height;\r
-this._imgNode = img;\r
-{\r
-canvas.width = w;\r
-canvas.height = h;\r
-var ctx = canvas.getContext("2d");\r
-ctx.drawImage(img, 0, 0, w, h);\r
-var data = ctx.getImageData(0, 0, w, h).data;\r
-img._pbuf32 = this.toIntARGB(data);\r
-}}, "swingjs.api.DOMNode");\r
-Clazz.defineMethod (c$, "getHeight", \r
-function (o) {\r
-return this.height;\r
-}, "java.awt.image.ImageObserver");\r
-Clazz.defineMethod (c$, "getWidth", \r
-function (o) {\r
-return this.width;\r
-}, "java.awt.image.ImageObserver");\r
-});\r
+Clazz.declarePackage ("swingjs");
+Clazz.load (["java.awt.image.BufferedImage"], "swingjs.JSImage", ["JU.Base64", "swingjs.api.DOMNode"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.typeRequested = 0;
+this.pix = null;
+this._imgNode = null;
+this.width = 0;
+this.height = 0;
+Clazz.instantialize (this, arguments);
+}, swingjs, "JSImage", java.awt.image.BufferedImage);
+Clazz.makeConstructor (c$, 
+function (argb, width, height) {
+Clazz.superConstructor (this, swingjs.JSImage, [width, height, 2]);
+this.width = width;
+this.height = height;
+this.pix = argb;
+}, "~A,~N,~N");
+Clazz.defineMethod (c$, "toIntARGB", 
+function (imgData) {
+var n = Clazz.doubleToInt (imgData.length / 4);
+var iData =  Clazz.newIntArray (n, 0);
+for (var i = 0, j = 0; i < n; j++) iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | 0xFF000000;
+
+return iData;
+}, "~A");
+Clazz.defineMethod (c$, "getDOMImage", 
+function (b, type) {
+var dataurl = "data:image/" + type + ";base64," + JU.Base64.getBase64 (b).toString ();
+var me = this;
+var img = null;
+{
+img = new Image(this.width, this.height);
+//img.onLoad = function() { me.setDOMImage(img); };
+img.src = dataurl;
+}this.setDOMImage (img);
+}, "~A,~S");
+Clazz.defineMethod (c$, "setDOMImage", 
+function (img) {
+var canvas = swingjs.api.DOMNode.createElement ("canvas", "JSImage");
+var w = this.width;
+var h = this.height;
+this._imgNode = img;
+{
+canvas.width = w;
+canvas.height = h;
+var ctx = canvas.getContext("2d");
+ctx.drawImage(img, 0, 0, w, h);
+var data = ctx.getImageData(0, 0, w, h).data;
+img._pbuf32 = this.toIntARGB(data);
+}}, "swingjs.api.DOMNode");
+Clazz.defineMethod (c$, "getHeight", 
+function (o) {
+return this.height;
+}, "java.awt.image.ImageObserver");
+Clazz.defineMethod (c$, "getWidth", 
+function (o) {
+return this.width;
+}, "java.awt.image.ImageObserver");
+});