@Override
protected GraphicsNode createImageGraphicsNode
(BridgeContext ctx, Element imageElement, ParsedURL purl) {
AbstractFOPBridgeContext bridgeCtx = (AbstractFOPBridgeContext)ctx;
ImageManager manager = bridgeCtx.getImageManager();
ImageSessionContext sessionContext = bridgeCtx.getImageSessionContext();
try {
ImageInfo info = manager.getImageInfo(purl.toString(), sessionContext);
ImageFlavor[] supportedFlavors = getSupportedFlavours();
Image image = manager.getImage(info, supportedFlavors, sessionContext);
//TODO color profile overrides aren't handled, yet!
//ICCColorSpaceExt colorspaceOverride = extractColorSpace(e, ctx);
AbstractGraphicsNode specializedNode = null;
if (image instanceof ImageXMLDOM) {
ImageXMLDOM xmlImage = (ImageXMLDOM)image;
if (xmlImage.getDocument() instanceof SVGDocument) {
//Clone DOM because the Batik's CSS Parser attaches to the DOM and is therefore
//not thread-safe.
SVGDocument clonedDoc = (SVGDocument)BatikUtil.cloneSVGDocument(
xmlImage.getDocument());
return createSVGImageNode(ctx, imageElement, clonedDoc);
} else {
//Convert image to Graphics2D
image = manager.convertImage(xmlImage,
new ImageFlavor[] {ImageFlavor.GRAPHICS2D});
}
}
if (image instanceof ImageRawJPEG) {
specializedNode = createLoaderImageNode(image, ctx, imageElement, purl);