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