1 Clazz.declarePackage ("java.awt.image");
2 Clazz.load (["java.awt.image.LookupTable"], "java.awt.image.ByteLookupTable", ["java.lang.ArrayIndexOutOfBoundsException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 Clazz.instantialize (this, arguments);
6 }, java.awt.image, "ByteLookupTable", java.awt.image.LookupTable);
7 Clazz.makeConstructor (c$,
8 function (offset, data) {
9 Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]);
10 this.numComponents = data.length;
11 this.numEntries = data[0].length;
12 this.data = Clazz.newByteArray (this.numComponents, 0);
13 for (var i = 0; i < this.numComponents; i++) {
14 this.data[i] = data[i];
17 Clazz.makeConstructor (c$,
18 function (offset, data) {
19 Clazz.superConstructor (this, java.awt.image.ByteLookupTable, [offset, data.length]);
20 this.numComponents = 1;
21 this.numEntries = data.length;
22 this.data = Clazz.newByteArray (1, 0);
25 Clazz.defineMethod (c$, "getTable",
29 Clazz.defineMethod (c$, "lookupPixel",
32 dst = Clazz.newIntArray (src.length, 0);
33 }if (this.numComponents == 1) {
34 for (var i = 0; i < src.length; i++) {
35 var s = src[i] - this.offset;
37 throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero");
38 }dst[i] = this.data[0][s];
41 for (var i = 0; i < src.length; i++) {
42 var s = src[i] - this.offset;
44 throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero");
45 }dst[i] = this.data[i][s];
49 Clazz.defineMethod (c$, "lookupPixel",
52 dst = Clazz.newByteArray (src.length, 0);
53 }if (this.numComponents == 1) {
54 for (var i = 0; i < src.length; i++) {
55 var s = (src[i] & 0xff) - this.offset;
57 throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero");
58 }dst[i] = this.data[0][s];
61 for (var i = 0; i < src.length; i++) {
62 var s = (src[i] & 0xff) - this.offset;
64 throw new ArrayIndexOutOfBoundsException ("src[" + i + "]-offset is " + "less than zero");
65 }dst[i] = this.data[i][s];