/**
* @see org.apache.fop.pdf.PDFImage#setup(PDFDocument)
*/
public void setup(PDFDocument doc) {
if ("image/jpeg".equals(fopImage.getMimeType())) {
pdfFilter = new DCTFilter();
pdfFilter.setApplied(true);
isDCT = true;
JpegImage jpegimage = (JpegImage) fopImage;
ICC_Profile prof = jpegimage.getICCProfile();
PDFColorSpace pdfCS = toPDFColorSpace(jpegimage.getColorSpace());
if (prof != null) {
pdfICCStream = doc.getFactory().makePDFICCStream();
pdfICCStream.setColorSpace(prof, pdfCS);
}
} else if ("image/tiff".equals(fopImage.getMimeType())
&& fopImage instanceof TIFFImage) {
TIFFImage tiffImage = (TIFFImage) fopImage;
if (tiffImage.getStripCount() == 1) {
int comp = tiffImage.getCompression();
if (comp == 1) {
// Nothing to do
} else if (comp == 3) {
pdfFilter = new CCFFilter();
pdfFilter.setApplied(true);
isCCF = true;
} else if (comp == 4) {
pdfFilter = new CCFFilter();
pdfFilter.setApplied(true);
((CCFFilter)pdfFilter).setDecodeParms("<< /K -1 /Columns "
+ tiffImage.getWidth() + " >>");
isCCF = true;
} else if (comp == 6) {
pdfFilter = new DCTFilter();
pdfFilter.setApplied(true);
isDCT = true;
}
}
}