]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fixes resource naming/levelling for fox:conversion-mode="bitmap" GOCA fallback.
authorAdrian Cumiskey <acumiskey@apache.org>
Tue, 14 Oct 2008 10:19:16 +0000 (10:19 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Tue, 14 Oct 2008 10:19:16 +0000 (10:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@704434 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/afp/AFPGraphics2D.java
src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
src/java/org/apache/fop/render/afp/AFPInfo.java
src/java/org/apache/fop/render/afp/AFPSVGHandler.java

index ea98fe18e265d46c5dc5b44edf13a0fcc397ad40..fba0cff71b1796da04abc4fbd333c3aad5a3d6e4 100644 (file)
@@ -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) {
index f9759676fa0fa836857698c7baf287c616549d56..6561902d9f2c1b805b07564f2450fe699f965b40 100644 (file)
@@ -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);
index 626428a9799190bfdadd89f9219bcad2de89fded..5c14ab507fad2935b4675948fca9972965e15173 100644 (file)
@@ -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
         + "}";
     }
 
index 508c13efba10de3a22b889def2843d28ae2baf69..4c456a0b61add6bf2ebe6f6fab380487252ec9bc 100644 (file)
@@ -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);