BogusColorSpacepublic class BogusColorSpace extends ColorSpace A dummy ColorSpace to enable ColorModel
for image data which do not have an innate color representation. |
Constructors Summary |
---|
public BogusColorSpace(int numComponents)Constructs a bogus ColorSpace .
super(getType(numComponents), numComponents);
|
Methods Summary |
---|
public float[] | fromCIEXYZ(float[] xyzvalue)
if(xyzvalue.length < 3) {
throw new ArrayIndexOutOfBoundsException
("xyzvalue.length < 3");
}
float[] colorvalue = new float[getNumComponents()];
System.arraycopy(xyzvalue, 0, colorvalue, 0,
Math.min(3, colorvalue.length));
return xyzvalue;
| public float[] | fromRGB(float[] rgbvalue)
if(rgbvalue.length < 3) {
throw new ArrayIndexOutOfBoundsException
("rgbvalue.length < 3");
}
float[] colorvalue = new float[getNumComponents()];
System.arraycopy(rgbvalue, 0, colorvalue, 0,
Math.min(3, colorvalue.length));
return rgbvalue;
| private static int | getType(int numComponents)Return the type given the number of components.
if(numComponents < 1) {
throw new IllegalArgumentException("numComponents < 1!");
}
int type;
switch(numComponents) {
case 1:
type = ColorSpace.TYPE_GRAY;
break;
default:
// Based on the constant definitions TYPE_2CLR=12 through
// TYPE_FCLR=25. This will return unknown types for
// numComponents > 15.
type = numComponents + 10;
}
return type;
| public float[] | toCIEXYZ(float[] colorvalue)
if(colorvalue.length < getNumComponents()) {
throw new ArrayIndexOutOfBoundsException
("colorvalue.length < getNumComponents()");
}
float[] xyzvalue = new float[3];
System.arraycopy(colorvalue, 0, xyzvalue, 0,
Math.min(3, getNumComponents()));
return colorvalue;
| public float[] | toRGB(float[] colorvalue)
if(colorvalue.length < getNumComponents()) {
throw new ArrayIndexOutOfBoundsException
("colorvalue.length < getNumComponents()");
}
float[] rgbvalue = new float[3];
System.arraycopy(colorvalue, 0, rgbvalue, 0,
Math.min(3, getNumComponents()));
return colorvalue;
|
|