X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjava%2Fawt%2Fimage%2FByteLookupTable.js;fp=site%2Fswingjs%2Fj2s%2Fjava%2Fawt%2Fimage%2FByteLookupTable.js;h=948e9a0fa43a1b1754266d48354579ce933d0da0;hp=df2e44400f778a33e11ec7183fe5c4e7ff5aec6b;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/java/awt/image/ByteLookupTable.js b/site/swingjs/j2s/java/awt/image/ByteLookupTable.js index df2e444..948e9a0 100644 --- a/site/swingjs/j2s/java/awt/image/ByteLookupTable.js +++ b/site/swingjs/j2s/java/awt/image/ByteLookupTable.js @@ -1,69 +1,69 @@ -Clazz.declarePackage ("java.awt.image"); -Clazz.load (["java.awt.image.LookupTable"], "java.awt.image.ByteLookupTable", ["java.lang.ArrayIndexOutOfBoundsException"], function () { -c$ = Clazz.decorateAsClass (function () { -this.data = null; -Clazz.instantialize (this, arguments); -}, java.awt.image, "ByteLookupTable", java.awt.image.LookupTable); -Clazz.makeConstructor (c$, -function (offset, data) { -Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]); -this.numComponents = data.length; -this.numEntries = data[0].length; -this.data = Clazz.newByteArray (this.numComponents, 0); -for (var i = 0; i < this.numComponents; i++) { -this.data[i] = data[i]; -} -}, "~N,~A"); -Clazz.makeConstructor (c$, -function (offset, data) { -Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]); -this.numComponents = 1; -this.numEntries = data.length; -this.data = Clazz.newByteArray (1, 0); -this.data[0] = data; -}, "~N,~A"); -Clazz.defineMethod (c$, "getTable", -function () { -return this.data; -}); -Clazz.defineMethod (c$, "lookupPixel", -function (src, dst) { -if (dst == null) { -dst = Clazz.newIntArray (src.length, 0); -}if (this.numComponents == 1) { -for (var i = 0; i < src.length; i++) { -var s = src[i] - this.offset; -if (s < 0) { -throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); -}dst[i] = this.data[0][s]; -} -} else { -for (var i = 0; i < src.length; i++) { -var s = src[i] - this.offset; -if (s < 0) { -throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); -}dst[i] = this.data[i][s]; -} -}return dst; -}, "~A,~A"); -Clazz.defineMethod (c$, "lookupPixel", -function (src, dst) { -if (dst == null) { -dst = Clazz.newByteArray (src.length, 0); -}if (this.numComponents == 1) { -for (var i = 0; i < src.length; i++) { -var s = (src[i] & 0xff) - this.offset; -if (s < 0) { -throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); -}dst[i] = this.data[0][s]; -} -} else { -for (var i = 0; i < src.length; i++) { -var s = (src[i] & 0xff) - this.offset; -if (s < 0) { -throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); -}dst[i] = this.data[i][s]; -} -}return dst; -}, "~A,~A"); -}); +Clazz.declarePackage ("java.awt.image"); +Clazz.load (["java.awt.image.LookupTable"], "java.awt.image.ByteLookupTable", ["java.lang.ArrayIndexOutOfBoundsException"], function () { +c$ = Clazz.decorateAsClass (function () { +this.data = null; +Clazz.instantialize (this, arguments); +}, java.awt.image, "ByteLookupTable", java.awt.image.LookupTable); +Clazz.makeConstructor (c$, +function (offset, data) { +Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]); +this.numComponents = data.length; +this.numEntries = data[0].length; +this.data = Clazz.newByteArray (this.numComponents, 0); +for (var i = 0; i < this.numComponents; i++) { +this.data[i] = data[i]; +} +}, "~N,~A"); +Clazz.makeConstructor (c$, +function (offset, data) { +Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]); +this.numComponents = 1; +this.numEntries = data.length; +this.data = Clazz.newByteArray (1, 0); +this.data[0] = data; +}, "~N,~A"); +Clazz.defineMethod (c$, "getTable", +function () { +return this.data; +}); +Clazz.defineMethod (c$, "lookupPixel", +function (src, dst) { +if (dst == null) { +dst = Clazz.newIntArray (src.length, 0); +}if (this.numComponents == 1) { +for (var i = 0; i < src.length; i++) { +var s = src[i] - this.offset; +if (s < 0) { +throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); +}dst[i] = this.data[0][s]; +} +} else { +for (var i = 0; i < src.length; i++) { +var s = src[i] - this.offset; +if (s < 0) { +throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); +}dst[i] = this.data[i][s]; +} +}return dst; +}, "~A,~A"); +Clazz.defineMethod (c$, "lookupPixel", +function (src, dst) { +if (dst == null) { +dst = Clazz.newByteArray (src.length, 0); +}if (this.numComponents == 1) { +for (var i = 0; i < src.length; i++) { +var s = (src[i] & 0xff) - this.offset; +if (s < 0) { +throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); +}dst[i] = this.data[0][s]; +} +} else { +for (var i = 0; i < src.length; i++) { +var s = (src[i] & 0xff) - this.offset; +if (s < 0) { +throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero"); +}dst[i] = this.data[i][s]; +} +}return dst; +}, "~A,~A"); +});