int y = mpts2units(pos.getY() + currentBPPosition);
_afpDataStream.createIncludePageSegment(name, x, y);
} else {
url = ImageFactory.getURL(url);
ImageFactory fact = userAgent.getFactory().getImageFactory();
FopImage fopimage = fact.getImage(url, userAgent);
if (fopimage == null) {
return;
}
if (!fopimage.load(FopImage.DIMENSIONS)) {
return;
}
String mime = fopimage.getMimeType();
if ("text/xml".equals(mime) || MimeConstants.MIME_SVG.equals(mime)) {
if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
Document doc = ((XMLImage) fopimage).getDocument();
String ns = ((XMLImage) fopimage).getNameSpace();
renderDocument(doc, ns, pos, foreignAttributes);
} else if (MimeConstants.MIME_EPS.equals(mime)) {
log.warn("EPS images are not supported by this renderer");
/*
} else if (MimeConstants.MIME_JPEG.equals(mime)) {
if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
fact.releaseImage(url, userAgent);
int x = mpts2units(pos.getX() + currentIPPosition);
int y = mpts2units(pos.getY() + currentBPPosition);
int w = mpts2units(pos.getWidth());
int h = mpts2units(pos.getHeight());
ImageObject io = _afpDataStream.getImageObject();
io.setImageViewport(x, y, w, h);
io.setImageParameters(
(int)(fopimage.getHorizontalResolution() * 10),
(int)(fopimage.getVerticalResolution() * 10),
fopimage.getWidth(),
fopimage.getHeight()
);
io.setImageIDESize((byte)fopimage.getBitsPerPixel());
io.setImageEncoding((byte)0x83);
io.setImageData(fopimage.getRessourceBytes());
*/
} else if (MimeConstants.MIME_TIFF.equals(mime)
&& fopimage instanceof TIFFImage) {
TIFFImage tiffImage = (TIFFImage) fopimage;
int x = mpts2units(pos.getX() + currentIPPosition);
int y = mpts2units(pos.getY() + currentBPPosition);
int w = mpts2units(pos.getWidth());
int h = mpts2units(pos.getHeight());
ImageObject io = _afpDataStream.getImageObject(x, y, w, h);
io.setImageParameters(
(int)(fopimage.getHorizontalResolution() * 10),
(int)(fopimage.getVerticalResolution() * 10),
fopimage.getWidth(),
fopimage.getHeight()
);
if (tiffImage.getStripCount() == 1) {
int comp = tiffImage.getCompression();
if (comp == 3) {
if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
io.setImageEncoding((byte)0x81);
io.setImageData(fopimage.getRessourceBytes());
} else if (comp == 4) {
if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
return;
}
io.setImageEncoding((byte)0x82);
io.setImageData(fopimage.getRessourceBytes());
} else {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
convertToGrayScaleImage(io, fopimage.getBitmaps(),
fopimage.getWidth(), fopimage.getHeight());
}
} else {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
convertToGrayScaleImage(io, fopimage.getBitmaps(),
fopimage.getWidth(), fopimage.getHeight());
}
} else {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
fact.releaseImage(url, userAgent);
int x = mpts2units(pos.getX() + currentIPPosition);
int y = mpts2units(pos.getY() + currentBPPosition);
int w = mpts2units(pos.getWidth());
int h = mpts2units(pos.getHeight());
ImageObject io = _afpDataStream.getImageObject(x, y, w, h);
io.setImageParameters(
(int)(fopimage.getHorizontalResolution() * 10),
(int)(fopimage.getVerticalResolution() * 10),
fopimage.getWidth(),
fopimage.getHeight()
);
if (colorImages) {
io.setImageIDESize((byte)24);
io.setImageData(fopimage.getBitmaps());
} else {
convertToGrayScaleImage(io, fopimage.getBitmaps(),
fopimage.getWidth(), fopimage.getHeight());
}
}
}
}