1 Clazz.declarePackage ("java.awt.color");
2 Clazz.load (null, "java.awt.color.ColorSpace", ["java.lang.IllegalArgumentException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.numComponents = 0;
7 Clazz.instantialize (this, arguments);
8 }, java.awt.color, "ColorSpace");
9 Clazz.makeConstructor (c$,
10 function (type, numcomponents) {
12 this.numComponents = numcomponents;
14 c$.getInstance = Clazz.defineMethod (c$, "getInstance",
15 function (colorspace) {
20 if (java.awt.color.ColorSpace.sRGBspace == null) {
21 java.awt.color.ColorSpace.sRGBspace = new java.awt.color.ColorSpace (5, 3);
22 }theColorSpace = java.awt.color.ColorSpace.sRGBspace;
27 Clazz.defineMethod (c$, "isCS_sRGB",
29 return (this === java.awt.color.ColorSpace.sRGBspace);
31 Clazz.defineMethod (c$, "toRGB",
32 function (colorvalue) {
35 Clazz.defineMethod (c$, "fromRGB",
39 Clazz.defineMethod (c$, "getType",
43 Clazz.defineMethod (c$, "getNumComponents",
45 return this.numComponents;
47 Clazz.defineMethod (c$, "getName",
49 if ((idx < 0) || (idx > this.numComponents - 1)) {
50 throw new IllegalArgumentException ("Component index out of range: " + idx);
51 }if (this.compName == null) {
54 this.compName = Clazz.newArray (-1, ["X", "Y", "Z"]);
57 this.compName = Clazz.newArray (-1, ["L", "a", "b"]);
60 this.compName = Clazz.newArray (-1, ["L", "u", "v"]);
63 this.compName = Clazz.newArray (-1, ["Y", "Cb", "Cr"]);
66 this.compName = Clazz.newArray (-1, ["Y", "x", "y"]);
69 this.compName = Clazz.newArray (-1, ["Red", "Green", "Blue"]);
72 this.compName = Clazz.newArray (-1, ["Gray"]);
75 this.compName = Clazz.newArray (-1, ["Hue", "Saturation", "Value"]);
78 this.compName = Clazz.newArray (-1, ["Hue", "Lightness", "Saturation"]);
81 this.compName = Clazz.newArray (-1, ["Cyan", "Magenta", "Yellow", "Black"]);
84 this.compName = Clazz.newArray (-1, ["Cyan", "Magenta", "Yellow"]);
87 var tmp = new Array (this.numComponents);
88 for (var i = 0; i < tmp.length; i++) {
89 tmp[i] = "Unnamed color component(" + i + ")";
93 }return this.compName[idx];
95 Clazz.defineMethod (c$, "getMinValue",
96 function (component) {
97 if ((component < 0) || (component > this.numComponents - 1)) {
98 throw new IllegalArgumentException ("Component index out of range: " + component);
101 Clazz.defineMethod (c$, "getMaxValue",
102 function (component) {
103 if ((component < 0) || (component > this.numComponents - 1)) {
104 throw new IllegalArgumentException ("Component index out of range: " + component);
107 Clazz.defineStatics (c$,
135 "CS_LINEAR_RGB", 1004,