Author: acumiskey
Date: Fri Nov 21 06:29:17 2008
New Revision: 719587

URL: http://svn.apache.org/viewvc?rev=719587&view=rev
Log:
<svg:image/> y-axis positioning fix in AFPGraphics2D.
GraphicsState inner class created in GraphicsObject.
Unused methods setFill() and incrementPageFontCount() removed.

Modified:
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceManager.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/GraphicsObject.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPDataObjectFactory.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
 Fri Nov 21 06:29:17 2008
@@ -63,6 +63,9 @@
     public ObjectContainer createObjectContainer(AFPDataObjectInfo 
dataObjectInfo) {
         ObjectContainer objectContainer = factory.createObjectContainer();
 
+        // set data object viewport (i.e. position, rotation, dimension, 
resolution)
+        objectContainer.setViewport(dataObjectInfo);
+
         // set object classification
         Registry.ObjectType objectType = dataObjectInfo.getObjectType();
         AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
@@ -87,6 +90,10 @@
     public ImageObject createImage(AFPImageObjectInfo imageObjectInfo) {
         // IOCA bitmap image
         ImageObject imageObj = factory.createImageObject();
+
+        // set data object viewport (i.e. position, rotation, dimension, 
resolution)
+        imageObj.setViewport(imageObjectInfo);
+
         if (imageObjectInfo.hasCompression()) {
             int compression = imageObjectInfo.getCompression();
             switch (compression) {
@@ -124,6 +131,10 @@
     public GraphicsObject createGraphic(AFPGraphicsObjectInfo 
graphicsObjectInfo) {
         // set newly created graphics object in g2d
         GraphicsObject graphicsObj = factory.createGraphicsObject();
+
+        // set data object viewport (i.e. position, rotation, dimension, 
resolution)
+        graphicsObj.setViewport(graphicsObjectInfo);
+
         AFPGraphics2D g2d = graphicsObjectInfo.getGraphics2D();
         g2d.setGraphicsObject(graphicsObj);
 

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java
 Fri Nov 21 06:29:17 2008
@@ -580,13 +580,17 @@
 
     /** [EMAIL PROTECTED] */
     public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
-        int width = img.getWidth();
-        int height = img.getHeight();
+        int imgWidth = img.getWidth();
+        int imgHeight = img.getHeight();
 
         AffineTransform at = paintingState.getData().getTransform();
         AffineTransform gat = gc.getTransform();
+        int graphicsObjectHeight
+            = 
graphicsObj.getObjectEnvironmentGroup().getObjectAreaDescriptor().getHeight();
         int x = (int)Math.round(at.getTranslateX() + gat.getTranslateX());
-        int y = (int)Math.round(at.getTranslateY());
+        int y = (int)Math.round(at.getTranslateY() - (gat.getTranslateY() - 
graphicsObjectHeight));
+        int width = (int)Math.round(imgWidth * gat.getScaleX());
+        int height = (int)Math.round(imgHeight * -gat.getScaleY());
         try {
             // get image object info
             AFPImageObjectInfo imageObjectInfo

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java
 Fri Nov 21 06:29:17 2008
@@ -224,20 +224,6 @@
     }
 
     /**
-     * Sets if the current painted shape is to be filled
-     *
-     * @param fill true if the current painted shape is to be filled
-     * @return true if the fill value has changed
-     */
-    protected boolean setFill(boolean fill) {
-        if (fill != ((AFPData)getData()).filled) {
-            ((AFPData)getData()).filled = fill;
-            return true;
-        }
-        return false;
-    }
-
-    /**
      * Gets the current page fonts
      *
      * @return the current page fonts
@@ -247,15 +233,6 @@
     }
 
     /**
-     * Increments and returns the page font count
-     *
-     * @return the page font count
-     */
-    public int incrementPageFontCount() {
-        return pagePaintingState.incrementFontCount();
-    }
-
-    /**
      * Sets the page width
      *
      * @param pageWidth the page width

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceManager.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceManager.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceManager.java
 Fri Nov 21 06:29:17 2008
@@ -23,7 +23,6 @@
 import java.io.OutputStream;
 import java.util.Map;
 
-import org.apache.fop.afp.modca.AbstractDataObject;
 import org.apache.fop.afp.modca.AbstractNamedAFPObject;
 import org.apache.fop.afp.modca.IncludeObject;
 import org.apache.fop.afp.modca.Registry;
@@ -136,18 +135,12 @@
                 AFPGraphicsObjectInfo graphicsObjectInfo = 
(AFPGraphicsObjectInfo)dataObjectInfo;
                 namedObj = dataObjectFactory.createGraphic(graphicsObjectInfo);
             } else {
-                // natively embedded object
+                // natively embedded data object
                 namedObj = 
dataObjectFactory.createObjectContainer(dataObjectInfo);
                 objectType = dataObjectInfo.getObjectType();
                 useInclude = objectType != null && objectType.isIncludable();
             }
 
-            // set data object viewport (i.e. position, rotation, dimension, 
resolution)
-            if (namedObj instanceof AbstractDataObject) {
-                AbstractDataObject dataObj = (AbstractDataObject)namedObj;
-                dataObj.setViewport(dataObjectInfo);
-            }
-
             AFPResourceLevel resourceLevel = resourceInfo.getLevel();
             ResourceGroup resourceGroup = 
streamer.getResourceGroup(resourceLevel);
             useInclude &= resourceGroup != null;

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java
 Fri Nov 21 06:29:17 2008
@@ -23,6 +23,7 @@
  * Base class for AFP descriptor objects
  */
 public abstract class AbstractDescriptor extends 
AbstractTripletStructuredObject {
+
     /** width of this descriptor */
     protected int width = 0;
     /** height of this descriptor */
@@ -61,4 +62,23 @@
         + ", widthRes=" + widthRes
         + ", heightRes=" + heightRes;
     }
+
+    /**
+     * Returns the width
+     *
+     * @return the width
+     */
+    public int getWidth() {
+        return this.width;
+    }
+
+    /**
+     * Returns the height
+     *
+     * @return the height
+     */
+    public int getHeight() {
+        return this.height;
+    }
+
 }

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/GraphicsObject.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/GraphicsObject.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/GraphicsObject.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/GraphicsObject.java
 Fri Nov 21 06:29:17 2008
@@ -55,27 +55,15 @@
  */
 public class GraphicsObject extends AbstractDataObject {
 
-    /** The graphics data */
+    /** the graphics data */
     private GraphicsData currentData = null;
 
     /** list of objects contained within this container */
     protected List/*<GraphicsDrawingOrder>*/ objects
         = new java.util.ArrayList/*<GraphicsDrawingOrder>*/();
 
-    /** the current color */
-    private Color currentColor;
-
-    /** the current line type */
-    private byte currentLineType;
-
-    /** the current line width */
-    private int currentLineWidth;
-
-    /** the current fill pattern */
-    private byte currentPatternSymbol;
-
-    /** the current character set */
-    private int currentCharacterSet;
+    /** the graphics state */
+    private final GraphicsState graphicsState = new GraphicsState();
 
     /**
      * Default constructor
@@ -151,9 +139,9 @@
      * @param color the active color to use
      */
     public void setColor(Color color) {
-        if (!color.equals(currentColor)) {
-            this.currentColor = color;
+        if (!color.equals(graphicsState.color)) {
             addObject(new GraphicsSetProcessColor(color));
+            graphicsState.color = color;
         }
     }
 
@@ -172,9 +160,9 @@
      * @param lineWidth the line width multiplier
      */
     public void setLineWidth(int lineWidth) {
-        if (lineWidth != currentLineWidth) {
-            currentLineWidth = lineWidth;
+        if (lineWidth != graphicsState.lineWidth) {
             addObject(new GraphicsSetLineWidth(lineWidth));
+            graphicsState.lineWidth = lineWidth;
         }
     }
 
@@ -184,9 +172,9 @@
      * @param lineType the line type
      */
     public void setLineType(byte lineType) {
-        if (lineType != currentLineType) {
-            currentLineType = lineType;
+        if (lineType != graphicsState.lineType) {
             addObject(new GraphicsSetLineType(lineType));
+            graphicsState.lineType = lineType;
         }
     }
 
@@ -207,9 +195,9 @@
      * @param the fill pattern of the next shape
      */
     public void setPatternSymbol(byte patternSymbol) {
-        if (currentPatternSymbol != patternSymbol) {
-            currentPatternSymbol = patternSymbol;
+        if (patternSymbol != graphicsState.patternSymbol) {
             addObject(new GraphicsSetPatternSymbol(patternSymbol));
+            graphicsState.patternSymbol = patternSymbol;
         }
     }
 
@@ -219,9 +207,9 @@
      * @param characterSet the character set (font) reference
      */
     public void setCharacterSet(int characterSet) {
-        if (currentCharacterSet != characterSet) {
-            currentCharacterSet = characterSet;
+        if (characterSet != graphicsState.characterSet) {
             addObject(new GraphicsSetCharacterSet(characterSet));
+            graphicsState.characterSet = characterSet;
         }
     }
 
@@ -377,4 +365,21 @@
         os.write(data);
     }
 
+    /** the internal graphics state */
+    private class GraphicsState {
+        /** the current color */
+        private Color color;
+
+        /** the current line type */
+        private byte lineType;
+
+        /** the current line width */
+        private int lineWidth;
+
+        /** the current fill pattern */
+        private byte patternSymbol;
+
+        /** the current character set */
+        private int characterSet;
+    }
 }
\ No newline at end of file

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java
 Fri Nov 21 06:29:17 2008
@@ -172,4 +172,13 @@
         this.mapContainerData = mapContainerData;
     }
 
+    /**
+     * Returns the object area descriptor
+     *
+     * @return the object area descriptor
+     */
+    public ObjectAreaDescriptor getObjectAreaDescriptor() {
+        return this.objectAreaDescriptor;
+    }
+
 }

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=719587&r1=719586&r2=719587&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
 Fri Nov 21 06:29:17 2008
@@ -517,7 +517,8 @@
 
         // register font as necessary
         String internalFontName = getInternalFontNameForArea(text);
-        AFPFont font = (AFPFont)fontInfo.getFonts().get(internalFontName);
+        Map/*<String,FontMetrics>*/ fontMetricMap = fontInfo.getFonts();
+        AFPFont font = (AFPFont)fontMetricMap.get(internalFontName);
         AFPPageFonts pageFonts = paintingState.getPageFonts();
         AFPFontAttributes fontAttributes = 
pageFonts.registerFont(internalFontName, font, fontSize);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to