Method from org.apache.pdfbox.pdmodel.graphics.color.PDSeparation Detail: |
public ColorModel createColorModel(int bpc) throws IOException {
log.info("About to create ColorModel for " + getAlternateColorSpace().toString());
return getAlternateColorSpace().createColorModel(bpc);
}
Create a Java color model for this colorspace. |
protected ColorSpace createColorSpace() throws IOException {
try
{
PDColorSpace alt = getAlternateColorSpace();
return alt.getJavaColorSpace();
}
catch (IOException ioexception)
{
log.error(ioexception, ioexception);
throw ioexception;
}
catch (Exception exception)
{
log.error(exception, exception);
throw new IOException("Failed to Create ColorSpace");
}
}
Create a Java colorspace for this colorspace. |
public PDColorSpace getAlternateColorSpace() throws IOException {
COSBase alternate = array.getObject( 2 );
PDColorSpace cs = PDColorSpaceFactory.createColorSpace( alternate );
return cs;
}
This will get the alternate color space for this separation. |
public COSArray getColorValues() throws IOException {
PDFunction tintTransform = getTintTransform();
if(tintTransform instanceof PDFunctionType2)
{
return (COSArray) getDictionary().getDictionaryObject("C1");
}
else
{
log.warn("Unsupported tint transformation type: "+tintTransform.getClass().getName()
+ " in "+getClass().getName()+".getColorValues()"
+ " using color black instead.");
int numberOfComponents = getAlternateColorSpace().getNumberOfComponents();
// To get black as color:
// 0.0f is used for the single value(s) if the colorspace is gray or RGB based
// 1.0f is used for the single value if the colorspace is CMYK based
float colorValue = numberOfComponents == 4 ? 1.0f : 0.0f;
COSArray retval = new COSArray();
for (int i=0;i< numberOfComponents;i++)
{
retval.add(new COSFloat(colorValue));
}
return retval;
}
}
Returns the components of the color in the alternate colorspace for a tint value of 1.0. |
public String getColorantName() {
COSName name = (COSName)array.getObject( 1 );
return name.getName();
}
This will get the separation name. |
public String getName() {
return NAME;
}
This will return the name of the color space. For a PDSeparation object
this will always return "Separation" |
public int getNumberOfComponents() throws IOException {
return getAlternateColorSpace().getNumberOfComponents();
}
This will get the number of components that this color space is made up of. |
public PDFunction getTintTransform() throws IOException {
return PDFunction.create( array.getObject( 3 ) );
}
This will get the tint transform function. |
public void setAlternateColorSpace(PDColorSpace cs) {
COSBase space = null;
if( cs != null )
{
space = cs.getCOSObject();
}
array.set( 2, space );
}
This will set the alternate color space. |
public void setColorantName(String name) {
array.set( 1, COSName.getPDFName( name ) );
}
This will set the separation name. |
public void setTintTransform(PDFunction tint) {
array.set( 3, tint );
}
This will set the tint transform function. |