diff options
Diffstat (limited to 'src/java/org/apache/fop/area/AreaTreeParser.java')
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeParser.java | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java index b4a804712..d4cdf5239 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/java/org/apache/fop/area/AreaTreeParser.java @@ -47,6 +47,10 @@ import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.ImageSessionContext; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.area.Trait.Background; import org.apache.fop.area.Trait.InternalLink; @@ -69,8 +73,6 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.extensions.ExtensionAttachment; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; -import org.apache.fop.image.FopImage; -import org.apache.fop.image.ImageFactory; import org.apache.fop.traits.BorderProps; import org.apache.fop.util.ColorUtil; import org.apache.fop.util.ContentHandlerFactory; @@ -1048,22 +1050,19 @@ public class AreaTreeParser { } catch (PropertyException e) { throw new IllegalArgumentException(e.getMessage()); } - String url = attributes.getValue("bkg-img"); - if (url != null) { - bkg.setURL(url); - - ImageFactory fact = userAgent.getFactory().getImageFactory(); - FopImage img = fact.getImage(url, userAgent); - if (img == null) { - log.error("Background image not available: " + url); - } else { - // load dimensions - if (!img.load(FopImage.DIMENSIONS)) { - log.error("Cannot read background image dimensions: " - + url); - } + String uri = attributes.getValue("bkg-img"); + if (uri != null) { + bkg.setURL(uri); + + try { + ImageManager manager = userAgent.getFactory().getImageManager(); + ImageSessionContext sessionContext + = userAgent.getImageSessionContext(); + ImageInfo info = manager.getImageInfo(uri, sessionContext); + bkg.setImageInfo(info); + } catch (Exception e) { + log.error("Background image not available: " + uri, e); } - bkg.setFopImage(img); String repeat = attributes.getValue("bkg-repeat"); if (repeat != null) { |