throw new MissingException("Unknown color space: " + name.getName());
}
}
else if (colorSpace instanceof COSArray)
{
COSArray array = (COSArray)colorSpace;
COSName name = (COSName)array.get(0);
// TODO cache these returned color spaces?
if (name == COSName.CALGRAY)
{
return new PDCalGray(array);
}
else if (name == COSName.CALRGB)
{
return new PDCalRGB(array);
}
else if (name == COSName.DEVICEN)
{
return new PDDeviceN(array);
}
else if (name == COSName.INDEXED || name == COSName.I)
{
return new PDIndexed(array);
}
else if (name == COSName.SEPARATION)
{
return new PDSeparation(array);
}
else if (name == COSName.ICCBASED)
{
return new PDICCBased(array);
}
else if (name == COSName.LAB)
{
return new PDLab(array);
}
else if (name == COSName.PATTERN)
{
if (array.size() == 1)
{
return new PDPattern(resources);
}
else
{
return new PDPattern(resources, PDColorSpace.create(array.get(1)));
}
}
else if (name == COSName.DEVICECMYK || name == COSName.CMYK ||
name == COSName.DEVICERGB || name == COSName.RGB ||
name == COSName.DEVICEGRAY || name == COSName.PATTERN)