From: Adrian Cumiskey Date: Tue, 14 Oct 2008 10:19:16 +0000 (+0000) Subject: Fixes resource naming/levelling for fox:conversion-mode="bitmap" GOCA fallback. X-Git-Tag: fop-1_0~376^2~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=13e70f13e05d417c46b76d683109334d085bc83d;p=xmlgraphics-fop.git Fixes resource naming/levelling for fox:conversion-mode="bitmap" GOCA fallback. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@704434 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/afp/AFPGraphics2D.java b/src/java/org/apache/fop/render/afp/AFPGraphics2D.java index ea98fe18e..fba0cff71 100644 --- a/src/java/org/apache/fop/render/afp/AFPGraphics2D.java +++ b/src/java/org/apache/fop/render/afp/AFPGraphics2D.java @@ -468,8 +468,9 @@ public class AFPGraphics2D extends AbstractGraphics2D { imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45); imageObjectInfo.setBitsPerPixel(state.getBitsPerPixel()); + imageObjectInfo.setResourceInfo(info.getResourceInfo()); - AFPResourceManager resourceManager = info.getAFPResourceManager(); + AFPResourceManager resourceManager = info.getResourceManager(); try { resourceManager.createObject(imageObjectInfo); } catch (IOException ioe) { diff --git a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java b/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java index f9759676f..6561902d9 100644 --- a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java @@ -96,14 +96,16 @@ public class AFPGraphics2DAdapter extends AbstractGraphics2DAdapter { RendererContextWrapper ctx = RendererContext.wrapRendererContext(context); BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false); + AffineTransform trans = state.getData().getTransform(); float scale = AFPRenderer.NORMAL_AFP_RESOLUTION / context.getUserAgent().getTargetResolution(); if (scale != 1) { at.scale(scale, scale); + if (!at.isIdentity()) { + trans.concatenate(at); + } } - AffineTransform trans = state.getData().getTransform(); - trans.concatenate(at); // concatenate to transformation matrix // state.concatenate(at); diff --git a/src/java/org/apache/fop/render/afp/AFPInfo.java b/src/java/org/apache/fop/render/afp/AFPInfo.java index 626428a97..5c14ab507 100644 --- a/src/java/org/apache/fop/render/afp/AFPInfo.java +++ b/src/java/org/apache/fop/render/afp/AFPInfo.java @@ -39,7 +39,7 @@ public final class AFPInfo { private int y; /** see HANDLER_CONFIGURATION */ - private Configuration cfg; + private Configuration handlerConfiguration; /** see AFP_FONT_INFO */ private FontInfo fontInfo; @@ -53,6 +53,9 @@ public final class AFPInfo { /** true if SVG should be rendered as a bitmap instead of natively */ private boolean paintAsBitmap; + /** the resource information */ + private AFPResourceInfo resourceInfo; + /** * Returns the width. * @@ -95,7 +98,7 @@ public final class AFPInfo { * @return the handler configuration */ public Configuration getHandlerConfiguration() { - return this.cfg; + return this.handlerConfiguration; } /** @@ -104,7 +107,7 @@ public final class AFPInfo { * @param cfg the handler configuration */ public void setHandlerConfiguration(Configuration cfg) { - this.cfg = cfg; + this.handlerConfiguration = cfg; } /** @@ -130,7 +133,7 @@ public final class AFPInfo { * * @return the AFPResourceManager */ - public AFPResourceManager getAFPResourceManager() { + public AFPResourceManager getResourceManager() { return this.resourceManager; } @@ -241,17 +244,36 @@ public final class AFPInfo { return this.paintAsBitmap; } + /** + * Sets the resource information + * + * @param resourceInfo the resource information + */ + public void setResourceInfo(AFPResourceInfo resourceInfo) { + this.resourceInfo = resourceInfo; + } + + /** + * Returns the resource information + * + * @return the resource information + */ + public AFPResourceInfo getResourceInfo() { + return resourceInfo; + } + /** {@inheritDoc} */ public String toString() { return "AFPInfo{width=" + width + ", height=" + height + ", x=" + x + ", y=" + y - + ", cfg=" + cfg + + ", cfg=" + handlerConfiguration + ", fontInfo=" + fontInfo + ", resourceManager=" + resourceManager + ", state=" + state + ", paintAsBitmap=" + paintAsBitmap + + ", resourceInfo=" + resourceInfo + "}"; } diff --git a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java b/src/java/org/apache/fop/render/afp/AFPSVGHandler.java index 508c13efb..4c456a0b6 100644 --- a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPSVGHandler.java @@ -82,11 +82,16 @@ public class AFPSVGHandler extends AbstractGenericSVGHandler { afpi.setResourceManager(((AFPResourceManager)context.getProperty( AFPRendererContextConstants.AFP_RESOURCE_MANAGER))); - Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES); - QName qName = new QName(ExtensionElementMapping.URI, null, "conversion-mode"); - if (foreign != null - && "bitmap".equalsIgnoreCase((String)foreign.get(qName))) { - afpi.setPaintAsBitmap(true); + Map foreignAttributes = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES); + if (foreignAttributes != null) { + AFPForeignAttributeReader foreignAttributeReader = new AFPForeignAttributeReader(); + AFPResourceInfo resourceInfo = foreignAttributeReader.getResourceInfo(foreignAttributes); + afpi.setResourceInfo(resourceInfo); + + QName qName = new QName(ExtensionElementMapping.URI, null, "conversion-mode"); + if ("bitmap".equalsIgnoreCase((String)foreignAttributes.get(qName))) { + afpi.setPaintAsBitmap(true); + } } return afpi; } @@ -225,7 +230,7 @@ public class AFPSVGHandler extends AbstractGenericSVGHandler { // Set the object area info graphicsObjectInfo.setObjectAreaInfo(objectAreaInfo); - AFPResourceManager resourceManager = afpInfo.getAFPResourceManager(); + AFPResourceManager resourceManager = afpInfo.getResourceManager(); // Create the graphics object resourceManager.createObject(graphicsObjectInfo);