1 |
/* Copyright (C) 2000, 2002 Free Software Foundation |
/* ICC_ColorSpace.java -- the canonical color space implementation |
2 |
|
Copyright (C) 2000, 2002 Free Software Foundation |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package java.awt.color; |
package java.awt.color; |
40 |
|
|
41 |
/** |
/** |
42 |
|
* NEEDS DOCUMENTATION |
43 |
|
* |
44 |
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no> |
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no> |
45 |
|
* @since 1.2 |
46 |
*/ |
*/ |
47 |
public class ICC_ColorSpace extends ColorSpace |
public class ICC_ColorSpace extends ColorSpace |
48 |
{ |
{ |
49 |
private ICC_Profile profile; |
/** |
50 |
|
* Compatible with JDK 1.2+. |
51 |
|
*/ |
52 |
|
private static final long serialVersionUID = 3455889114070431483L; |
53 |
|
|
54 |
|
/** |
55 |
|
* @serial |
56 |
|
*/ |
57 |
|
private ICC_Profile thisProfile; |
58 |
|
|
59 |
|
/** |
60 |
|
* @serial |
61 |
|
*/ |
62 |
|
private float[] minVal; |
63 |
|
|
64 |
|
/** |
65 |
|
* @serial |
66 |
|
*/ |
67 |
|
private float[] maxVal; |
68 |
|
|
69 |
|
/** |
70 |
|
* @serial |
71 |
|
*/ |
72 |
|
private float[] diffMinMax; |
73 |
|
|
74 |
|
/** |
75 |
|
* @serial |
76 |
|
*/ |
77 |
|
private float[] invDiffMinMax; |
78 |
|
|
79 |
|
/** |
80 |
|
* @serial |
81 |
|
*/ |
82 |
|
private boolean needScaleInit; |
83 |
|
|
84 |
public ICC_ColorSpace(ICC_Profile profile) |
public ICC_ColorSpace(ICC_Profile profile) |
85 |
{ |
{ |
86 |
super(CS_sRGB, profile.getNumComponents()); |
super(CS_sRGB, profile.getNumComponents()); |
87 |
|
thisProfile = profile; |
|
this.profile = profile; |
|
88 |
} |
} |
89 |
|
|
90 |
public ICC_Profile getProfile() |
public ICC_Profile getProfile() |
91 |
{ |
{ |
92 |
return profile; |
return thisProfile; |
93 |
} |
} |
94 |
|
|
95 |
public float[] toRGB(float[] colorvalue) |
public float[] toRGB(float[] colorvalue) |
117 |
} |
} |
118 |
|
|
119 |
/** |
/** |
120 |
* @param component The index of the color component |
* @since 1.4 |
|
* |
|
|
* @exception IllegalArgumentException If <code>component<code> is less |
|
|
* then 0 or greater then <code>numComponents - 1</code> |
|
121 |
*/ |
*/ |
122 |
public float getMinValue (int component) |
public float getMinValue(int idx) |
123 |
{ |
{ |
124 |
// FIXME: Not implemented |
if (type == TYPE_Lab && (idx == 1 || idx == 2)) |
125 |
throw new UnsupportedOperationException(); |
return -128; |
126 |
|
if (idx < 0 || idx >= numComponents) |
127 |
|
throw new IllegalArgumentException(); |
128 |
|
return 0; |
129 |
} |
} |
130 |
|
|
131 |
/** |
/** |
132 |
* @param component The index of the color component |
* @since 1.4 |
|
* |
|
|
* @exception IllegalArgumentException If <code>component<code> is less |
|
|
* then 0 or greater then <code>numComponents - 1</code> |
|
133 |
*/ |
*/ |
134 |
public float getMaxValue (int component) |
public float getMaxValue(int idx) |
135 |
{ |
{ |
136 |
// FIXME: Not implemented |
if (type == TYPE_XYZ && idx >= 0 && idx <= 2) |
137 |
throw new UnsupportedOperationException(); |
return 1 + 32767 / 32768f; |
138 |
|
else if (type == TYPE_Lab) |
139 |
|
{ |
140 |
|
if (idx == 0) |
141 |
|
return 100; |
142 |
|
if (idx == 1 || idx == 2) |
143 |
|
return 127; |
144 |
|
} |
145 |
|
if (idx < 0 || idx >= numComponents) |
146 |
|
throw new IllegalArgumentException(); |
147 |
|
return 1; |
148 |
} |
} |
149 |
} |
} // class ICC_ColorSpace |