@Override public ColorModel createColorModel( SampleModel sampleModel, List sources, Map configuration) { final int dataType = sampleModel.getDataType(); final int numBands = sampleModel.getNumBands(); ColorSpace cs; switch (numBands) { case 1: case 2: cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); break; case 3: cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); break; default: cs = new BogusColorSpace(numBands); } return RasterFactory.createComponentColorModel( dataType, cs, false, false, Transparency.OPAQUE); } });
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; }
final BogusColorSpace def = (BogusColorSpace) defCS; final BogusColorSpace act = (BogusColorSpace) actualCS; colorSpaceIsOk = def.getNumComponents() == act.getNumComponents() && def.isCS_sRGB() == act.isCS_sRGB() && def.getType() == act.getType();
/** * Constructs a bogus <code>ColorSpace</code>. * * @param numComponents The number of components in the * <code>ColorSpace</code>. * @exception IllegalArgumentException if <code>numComponents</code> * is less than 1. */ public BogusColorSpace(int numComponents) { super(getType(numComponents), numComponents); }
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; }
/** * Constructs a bogus <code>ColorSpace</code>. * * @param numComponents The number of components in the * <code>ColorSpace</code>. * @exception IllegalArgumentException if <code>numComponents</code> * is less than 1. */ public BogusColorSpace(int numComponents) { super(getType(numComponents), numComponents); }
final ColorModel newCm = new ComponentColorModel( new BogusColorSpace(numBands), false, // If true, supports transparency. false, // If true, alpha is premultiplied.
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; }
/** * Constructs a bogus <code>ColorSpace</code>. * * @param numComponents The number of components in the * <code>ColorSpace</code>. * @exception IllegalArgumentException if <code>numComponents</code> * is less than 1. */ public BogusColorSpace(int numComponents) { super(getType(numComponents), numComponents); }
colorSpace = new BogusColorSpace(numberOfBands); int[] numBits = new int[numberOfBands]; for (int i = 0; i < numberOfBands; i++) {
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; }
break; default: cs = new BogusColorSpace(nBands);
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; }
sampleModel, new ComponentColorModel( new BogusColorSpace(numBands), bitsPerSample, false,
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; }
break; default: cs = new BogusColorSpace(numBands);
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; }
break; default: cs = new BogusColorSpace(numBands);
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; } }
final int numBands=image.getSampleModel().getNumBands(); final ColorModel newCm= new ComponentColorModel( new BogusColorSpace(numBands), false, // If true, supports transparency. false, // If true, alpha is premultiplied.