NOTE: A color space is defined by an array object whose first element
is a name object identifying the color space family [PDF:1.6:4.5.2].
For families that do not require parameters, the color space CAN be
specified simply by the family name itself instead of an array.
*/
PdfName name = (PdfName)(baseDataObject instanceof PdfArray
? ((PdfArray)baseDataObject).get(0)
: baseDataObject);
if(name.equals(PdfName.DeviceRGB))
return new DeviceRGBColorSpace(baseObject,container);
else if(name.equals(PdfName.DeviceCMYK))
return new DeviceCMYKColorSpace(baseObject,container);
else if(name.equals(PdfName.DeviceGray))
return new DeviceGrayColorSpace(baseObject,container);
else if(name.equals(PdfName.CalRGB))
return new CalRGBColorSpace(baseObject,container);
else if(name.equals(PdfName.CalGray))
return new CalGrayColorSpace(baseObject,container);
else if(name.equals(PdfName.ICCBased))
return new ICCBasedColorSpace(baseObject,container);
else if(name.equals(PdfName.Lab))
return new LabColorSpace(baseObject,container);
else if(name.equals(PdfName.DeviceN))
return new DeviceNColorSpace(baseObject,container);
else if(name.equals(PdfName.Indexed))
return new IndexedColorSpace(baseObject,container);
else if(name.equals(PdfName.Pattern))
return new PatternColorSpace(baseObject,container);
else if(name.equals(PdfName.Separation))
return new SeparationColorSpace(baseObject,container);
else
throw new UnsupportedOperationException("Color space " + name + " unknown.");
}