Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / image / PackedColorModel.js
index 93b0d67..e765ae1 100644 (file)
-Clazz.declarePackage ("java.awt.image");\r
-Clazz.load (["java.awt.image.ColorModel"], "java.awt.image.PackedColorModel", ["java.lang.IllegalArgumentException"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.maskArray = null;\r
-this.maskOffsets = null;\r
-this.scaleFactors = null;\r
-Clazz.instantialize (this, arguments);\r
-}, java.awt.image, "PackedColorModel", java.awt.image.ColorModel);\r
-Clazz.makeConstructor (c$, \r
-function (space, bits, colorMaskArray, alphaMask, isAlphaPremultiplied, trans, transferType) {\r
-Clazz.superConstructor (this, java.awt.image.PackedColorModel, [bits, java.awt.image.PackedColorModel.createBitsArray (colorMaskArray, alphaMask), space, (alphaMask == 0 ? false : true), isAlphaPremultiplied, trans, transferType]);\r
-if (bits < 1 || bits > 32) {\r
-throw  new IllegalArgumentException ("Number of bits must be between 1 and 32.");\r
-}this.maskArray =  Clazz.newIntArray (this.numComponents, 0);\r
-this.maskOffsets =  Clazz.newIntArray (this.numComponents, 0);\r
-this.scaleFactors =  Clazz.newFloatArray (this.numComponents, 0);\r
-for (var i = 0; i < this.numColorComponents; i++) {\r
-this.DecomposeMask (colorMaskArray[i], i, space.getName (i));\r
-}\r
-if (alphaMask != 0) {\r
-this.DecomposeMask (alphaMask, this.numColorComponents, "alpha");\r
-if (this.nBits[this.numComponents - 1] == 1) {\r
-this.transparency = 2;\r
-}}}, "java.awt.color.ColorSpace,~N,~A,~N,~B,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (space, bits, rmask, gmask, bmask, amask, isAlphaPremultiplied, trans, transferType) {\r
-Clazz.superConstructor (this, java.awt.image.PackedColorModel, [bits, java.awt.image.PackedColorModel.createBitsArray (rmask, gmask, bmask, amask), space, (amask == 0 ? false : true), isAlphaPremultiplied, trans, transferType]);\r
-if (space.getType () != 5) {\r
-throw  new IllegalArgumentException ("ColorSpace must be TYPE_RGB.");\r
-}this.maskArray =  Clazz.newIntArray (this.numComponents, 0);\r
-this.maskOffsets =  Clazz.newIntArray (this.numComponents, 0);\r
-this.scaleFactors =  Clazz.newFloatArray (this.numComponents, 0);\r
-this.DecomposeMask (rmask, 0, "red");\r
-this.DecomposeMask (gmask, 1, "green");\r
-this.DecomposeMask (bmask, 2, "blue");\r
-if (amask != 0) {\r
-this.DecomposeMask (amask, 3, "alpha");\r
-if (this.nBits[3] == 1) {\r
-this.transparency = 2;\r
-}}}, "java.awt.color.ColorSpace,~N,~N,~N,~N,~N,~B,~N,~N");\r
-Clazz.defineMethod (c$, "getMask", \r
-function (index) {\r
-return this.maskArray[index];\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getMasks", \r
-function () {\r
-return this.maskArray.clone ();\r
-});\r
-Clazz.defineMethod (c$, "DecomposeMask", \r
- function (mask, idx, componentName) {\r
-var off = 0;\r
-var count = this.nBits[idx];\r
-this.maskArray[idx] = mask;\r
-if (mask != 0) {\r
-while ((mask & 1) == 0) {\r
-mask >>>= 1;\r
-off++;\r
-}\r
-}if (off + count > this.pixel_bits) {\r
-throw  new IllegalArgumentException (componentName + " mask " + Integer.toHexString (this.maskArray[idx]) + " overflows pixel (expecting " + this.pixel_bits + " bits");\r
-}this.maskOffsets[idx] = off;\r
-if (count == 0) {\r
-this.scaleFactors[idx] = 256.0;\r
-} else {\r
-this.scaleFactors[idx] = 255.0 / ((1 << count) - 1);\r
-}}, "~N,~N,~S");\r
-Clazz.defineMethod (c$, "equals", \r
-function (obj) {\r
-if (!(Clazz.instanceOf (obj, java.awt.image.PackedColorModel))) {\r
-return false;\r
-}if (!Clazz.superCall (this, java.awt.image.PackedColorModel, "equals", [obj])) {\r
-return false;\r
-}var cm = obj;\r
-var numC = cm.getNumComponents ();\r
-if (numC != this.numComponents) {\r
-return false;\r
-}for (var i = 0; i < numC; i++) {\r
-if (this.maskArray[i] != cm.getMask (i)) {\r
-return false;\r
-}}\r
-return true;\r
-}, "~O");\r
-c$.createBitsArray = Clazz.defineMethod (c$, "createBitsArray", \r
- function (colorMaskArray, alphaMask) {\r
-var numColors = colorMaskArray.length;\r
-var numAlpha = (alphaMask == 0 ? 0 : 1);\r
-var arr =  Clazz.newIntArray (numColors + numAlpha, 0);\r
-for (var i = 0; i < numColors; i++) {\r
-arr[i] = java.awt.image.PackedColorModel.countBits (colorMaskArray[i]);\r
-if (arr[i] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous color mask (" + Integer.toHexString (colorMaskArray[i]) + "at index " + i);\r
-}}\r
-if (alphaMask != 0) {\r
-arr[numColors] = java.awt.image.PackedColorModel.countBits (alphaMask);\r
-if (arr[numColors] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous alpha mask (" + Integer.toHexString (alphaMask));\r
-}}return arr;\r
-}, "~A,~N");\r
-c$.createBitsArray = Clazz.defineMethod (c$, "createBitsArray", \r
- function (rmask, gmask, bmask, amask) {\r
-var arr =  Clazz.newIntArray (3 + (amask == 0 ? 0 : 1), 0);\r
-arr[0] = java.awt.image.PackedColorModel.countBits (rmask);\r
-arr[1] = java.awt.image.PackedColorModel.countBits (gmask);\r
-arr[2] = java.awt.image.PackedColorModel.countBits (bmask);\r
-if (arr[0] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous red mask (" + Integer.toHexString (rmask));\r
-} else if (arr[1] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous green mask (" + Integer.toHexString (gmask));\r
-} else if (arr[2] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous blue mask (" + Integer.toHexString (bmask));\r
-}if (amask != 0) {\r
-arr[3] = java.awt.image.PackedColorModel.countBits (amask);\r
-if (arr[3] < 0) {\r
-throw  new IllegalArgumentException ("Noncontiguous alpha mask (" + Integer.toHexString (amask));\r
-}}return arr;\r
-}, "~N,~N,~N,~N");\r
-c$.countBits = Clazz.defineMethod (c$, "countBits", \r
- function (mask) {\r
-var count = 0;\r
-if (mask != 0) {\r
-while ((mask & 1) == 0) {\r
-mask >>>= 1;\r
-}\r
-while ((mask & 1) == 1) {\r
-mask >>>= 1;\r
-count++;\r
-}\r
-}if (mask != 0) {\r
-return -1;\r
-}return count;\r
-}, "~N");\r
-});\r
+Clazz.declarePackage ("java.awt.image");
+Clazz.load (["java.awt.image.ColorModel"], "java.awt.image.PackedColorModel", ["java.lang.IllegalArgumentException"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.maskArray = null;
+this.maskOffsets = null;
+this.scaleFactors = null;
+Clazz.instantialize (this, arguments);
+}, java.awt.image, "PackedColorModel", java.awt.image.ColorModel);
+Clazz.makeConstructor (c$, 
+function (space, bits, colorMaskArray, alphaMask, isAlphaPremultiplied, trans, transferType) {
+Clazz.superConstructor (this, java.awt.image.PackedColorModel, [bits, java.awt.image.PackedColorModel.createBitsArray (colorMaskArray, alphaMask), space, (alphaMask == 0 ? false : true), isAlphaPremultiplied, trans, transferType]);
+if (bits < 1 || bits > 32) {
+throw  new IllegalArgumentException ("Number of bits must be between 1 and 32.");
+}this.maskArray =  Clazz.newIntArray (this.numComponents, 0);
+this.maskOffsets =  Clazz.newIntArray (this.numComponents, 0);
+this.scaleFactors =  Clazz.newFloatArray (this.numComponents, 0);
+for (var i = 0; i < this.numColorComponents; i++) {
+this.DecomposeMask (colorMaskArray[i], i, space.getName (i));
+}
+if (alphaMask != 0) {
+this.DecomposeMask (alphaMask, this.numColorComponents, "alpha");
+if (this.nBits[this.numComponents - 1] == 1) {
+this.transparency = 2;
+}}}, "java.awt.color.ColorSpace,~N,~A,~N,~B,~N,~N");
+Clazz.makeConstructor (c$, 
+function (space, bits, rmask, gmask, bmask, amask, isAlphaPremultiplied, trans, transferType) {
+Clazz.superConstructor (this, java.awt.image.PackedColorModel, [bits, java.awt.image.PackedColorModel.createBitsArray (rmask, gmask, bmask, amask), space, (amask == 0 ? false : true), isAlphaPremultiplied, trans, transferType]);
+if (space.getType () != 5) {
+throw  new IllegalArgumentException ("ColorSpace must be TYPE_RGB.");
+}this.maskArray =  Clazz.newIntArray (this.numComponents, 0);
+this.maskOffsets =  Clazz.newIntArray (this.numComponents, 0);
+this.scaleFactors =  Clazz.newFloatArray (this.numComponents, 0);
+this.DecomposeMask (rmask, 0, "red");
+this.DecomposeMask (gmask, 1, "green");
+this.DecomposeMask (bmask, 2, "blue");
+if (amask != 0) {
+this.DecomposeMask (amask, 3, "alpha");
+if (this.nBits[3] == 1) {
+this.transparency = 2;
+}}}, "java.awt.color.ColorSpace,~N,~N,~N,~N,~N,~B,~N,~N");
+Clazz.defineMethod (c$, "getMask", 
+function (index) {
+return this.maskArray[index];
+}, "~N");
+Clazz.defineMethod (c$, "getMasks", 
+function () {
+return this.maskArray.clone ();
+});
+Clazz.defineMethod (c$, "DecomposeMask", 
+ function (mask, idx, componentName) {
+var off = 0;
+var count = this.nBits[idx];
+this.maskArray[idx] = mask;
+if (mask != 0) {
+while ((mask & 1) == 0) {
+mask >>>= 1;
+off++;
+}
+}if (off + count > this.pixel_bits) {
+throw  new IllegalArgumentException (componentName + " mask " + Integer.toHexString (this.maskArray[idx]) + " overflows pixel (expecting " + this.pixel_bits + " bits");
+}this.maskOffsets[idx] = off;
+if (count == 0) {
+this.scaleFactors[idx] = 256.0;
+} else {
+this.scaleFactors[idx] = 255.0 / ((1 << count) - 1);
+}}, "~N,~N,~S");
+Clazz.defineMethod (c$, "equals", 
+function (obj) {
+if (!(Clazz.instanceOf (obj, java.awt.image.PackedColorModel))) {
+return false;
+}if (!Clazz.superCall (this, java.awt.image.PackedColorModel, "equals", [obj])) {
+return false;
+}var cm = obj;
+var numC = cm.getNumComponents ();
+if (numC != this.numComponents) {
+return false;
+}for (var i = 0; i < numC; i++) {
+if (this.maskArray[i] != cm.getMask (i)) {
+return false;
+}}
+return true;
+}, "~O");
+c$.createBitsArray = Clazz.defineMethod (c$, "createBitsArray", 
+ function (colorMaskArray, alphaMask) {
+var numColors = colorMaskArray.length;
+var numAlpha = (alphaMask == 0 ? 0 : 1);
+var arr =  Clazz.newIntArray (numColors + numAlpha, 0);
+for (var i = 0; i < numColors; i++) {
+arr[i] = java.awt.image.PackedColorModel.countBits (colorMaskArray[i]);
+if (arr[i] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous color mask (" + Integer.toHexString (colorMaskArray[i]) + "at index " + i);
+}}
+if (alphaMask != 0) {
+arr[numColors] = java.awt.image.PackedColorModel.countBits (alphaMask);
+if (arr[numColors] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous alpha mask (" + Integer.toHexString (alphaMask));
+}}return arr;
+}, "~A,~N");
+c$.createBitsArray = Clazz.defineMethod (c$, "createBitsArray", 
+ function (rmask, gmask, bmask, amask) {
+var arr =  Clazz.newIntArray (3 + (amask == 0 ? 0 : 1), 0);
+arr[0] = java.awt.image.PackedColorModel.countBits (rmask);
+arr[1] = java.awt.image.PackedColorModel.countBits (gmask);
+arr[2] = java.awt.image.PackedColorModel.countBits (bmask);
+if (arr[0] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous red mask (" + Integer.toHexString (rmask));
+} else if (arr[1] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous green mask (" + Integer.toHexString (gmask));
+} else if (arr[2] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous blue mask (" + Integer.toHexString (bmask));
+}if (amask != 0) {
+arr[3] = java.awt.image.PackedColorModel.countBits (amask);
+if (arr[3] < 0) {
+throw  new IllegalArgumentException ("Noncontiguous alpha mask (" + Integer.toHexString (amask));
+}}return arr;
+}, "~N,~N,~N,~N");
+c$.countBits = Clazz.defineMethod (c$, "countBits", 
+ function (mask) {
+var count = 0;
+if (mask != 0) {
+while ((mask & 1) == 0) {
+mask >>>= 1;
+}
+while ((mask & 1) == 1) {
+mask >>>= 1;
+count++;
+}
+}if (mask != 0) {
+return -1;
+}return count;
+}, "~N");
+});