import java.io.InputStream;
import org.apache.commons.io.IOUtils;
+
import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
/**
private PDFICCStream iccStream;
private String explicitName;
+ private int numComponents;
/**
* Constructs a the ICCBased color space with an explicit name (ex. "DefaultRGB").
public PDFICCBasedColorSpace(String explicitName, PDFICCStream iccStream) {
this.explicitName = explicitName;
this.iccStream = iccStream;
+ this.numComponents = iccStream.getICCProfile().getNumComponents();
}
/**
/** {@inheritDoc} */
public int getNumComponents() {
- return iccStream.getICCProfile().getNumComponents();
+ return this.numComponents;
}
/** {@inheritDoc} */
}
/** {@inheritDoc} */
+ @Override
protected String toPDFString() {
StringBuffer sb = new StringBuffer(64);
sb.append(getObjectID());
pdfColorSpace = alt;
}
- /** @return the ICC profile */
+ /**
+ * Returns the associated ICC profile. Note that this will return null once the
+ * ICC stream has been written to the PDF file.
+ * @return the ICC profile (or null if the stream has already been written)
+ */
public ICC_Profile getICCProfile() {
return this.cp;
}
* byte arrays around so much
* {@inheritDoc}
*/
+ @Override
protected int output(java.io.OutputStream stream)
throws java.io.IOException {
int length = super.output(stream);
}
/** {@inheritDoc} */
+ @Override
protected void outputRawStreamData(OutputStream out) throws IOException {
cp.write(out);
}
/** {@inheritDoc} */
+ @Override
protected void populateStreamDict(Object lengthEntry) {
put("N", cp.getNumComponents());
if (pdfColorSpace != null) {