You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/11/04 16:30:39 UTC

svn commit: r711273 [1/2] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop: ./ afp/ afp/ioca/ afp/modca/ image/loader/batik/ pdf/ render/ render/afp/ render/java2d/ render/pdf/ svg/ util/

Author: acumiskey
Date: Tue Nov  4 07:30:38 2008
New Revision: 711273

URL: http://svn.apache.org/viewvc?rev=711273&view=rev
Log:
"fixed" block container handling fixed (see block-container_absolute-position_fixed.xml).
Barcode4J generating barcodes correctly for both GOCA and conversion-mode="bitmap".
AbstractGenericSVGHandler now declares use of static final String BITMAP which is used by concrete subclasses and provides overridable methods. for buildGraphicsNode() and createPainter().
*State classes are now renamed *PaintingState.
AFPImageGraphics2DFactory - painter is not overriden but is now instead prepared for y-axis inversion.
AFPGraphics2DAdapter - commented lines removed.
Inlining now only done when the graphic is a non conversion-mode="bitmap".

Added:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java
      - copied, changed from r709373, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPState.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java
      - copied, changed from r708877, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/BatikGraphics2DImagePainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java   (contents, props changed)
      - copied, changed from r709373, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFState.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/GraphicsObjectPainterAFP.java   (contents, props changed)
      - copied, changed from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPBatikGraphicsObjectPainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/util/AbstractPaintingState.java
      - copied, changed from r709373, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/AbstractState.java
Removed:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/AbstractData.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/AbstractState.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/StateStack.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPAbstractGraphicsObjectPainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPState.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/BatikGraphics2DImagePainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFState.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPBatikGraphicsObjectPainter.java
Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPBorderPainter.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/AFPRectanglePainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceLevel.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/AFPStreamer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPUnitConverter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AbstractAFPPainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Factory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/ImageContent.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/DataStream.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPAbstractImageFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoProvider.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageGraphics2DFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRawStreamFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRenderedFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPInfo.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRawCCITTFaxFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRendererContextConstants.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPBorderPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPBorderPainter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPBorderPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPBorderPainter.java Tue Nov  4 07:30:38 2008
@@ -33,10 +33,10 @@
     /**
      * Main constructor
      *
-     * @param state the unit converter
-     * @param dataStream the afp datastream
+     * @param state the AFP painting state converter
+     * @param dataStream the AFP datastream
      */
-    public AFPBorderPainter(AFPState state, DataStream dataStream) {
+    public AFPBorderPainter(AFPPaintingState state, DataStream dataStream) {
         super(state, dataStream);
     }
 

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=711273&r1=711272&r2=711273&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 Tue Nov  4 07:30:38 2008
@@ -98,7 +98,7 @@
     private AFPResourceInfo resourceInfo = null;
 
     /** Current AFP state */
-    private AFPState state = null;
+    private AFPPaintingState state = null;
 
     /** The AFP FontInfo */
     private FontInfo fontInfo;
@@ -498,15 +498,15 @@
 
         g2d.fillRect(0, 0, width, height);
 
-        int bufferedWidth = bufferedImage.getWidth();
-        int bufferedHeight = bufferedImage.getHeight();
-        Rectangle clipRect = new Rectangle(0, 0, bufferedWidth, bufferedHeight);
+        int imageWidth = bufferedImage.getWidth();
+        int imageHeight = bufferedImage.getHeight();
+        Rectangle clipRect = new Rectangle(0, 0, imageWidth, imageHeight);
         g2d.clip(clipRect);
 
         g2d.setComposite(gc.getComposite());
 
-        boolean drawn = g2d.drawImage(img, 0, 0, bufferedWidth, bufferedHeight, observer);
-        g2d.dispose();
+        boolean drawn = g2d.drawImage(img, 0, 0, imageWidth, imageHeight, observer);
+        g2d.dispose(); //drawn so dispose immediately to free system resource
 
         if (drawn) {
             try {
@@ -575,11 +575,11 @@
     }
 
     /**
-     * Sets the AFP state
+     * Sets the AFP painting state
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public void setState(AFPState state) {
+    public void setPaintingState(AFPPaintingState state) {
         this.state = state;
     }
 
@@ -588,7 +588,7 @@
      *
      * @return the AFP state
      */
-    public AFPState getState() {
+    public AFPPaintingState getPaintingState() {
         return this.state;
     }
 

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java (from r709373, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPState.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPState.java&r1=709373&r2=711273&rev=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPState.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPaintingState.java Tue Nov  4 07:30:38 2008
@@ -21,13 +21,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.AbstractData;
-import org.apache.fop.AbstractState;
+import org.apache.fop.util.AbstractPaintingState;
 
 /**
- * This keeps information about the current state when writing to an AFP datastream.
+ * This keeps information about the current painting state when writing to an AFP datastream.
  */
-public class AFPState extends org.apache.fop.AbstractState implements Cloneable {
+public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState  implements Cloneable {
 
     private static final long serialVersionUID = 8206711712452344473L;
 
@@ -52,7 +51,7 @@
     private int resolution = 240; // 240 dpi
 
     /** the current page */
-    private AFPPageState pageState = new AFPPageState();
+    private AFPPagePaintingState pagePaintingState = new AFPPagePaintingState();
 
 //    /** reference orientation */
 //    private int orientation = 0;
@@ -209,17 +208,17 @@
     }
 
     /** {@inheritDoc} */
-    protected AbstractState instantiateState() {
-        return new AFPState();
+    protected AbstractPaintingState instantiate() {
+        return new AFPPaintingState();
     }
 
     /**
-     * Returns the state of the current page
+     * Returns the painting state of the current page
      *
-     * @return the state of the current page
+     * @return the painting state of the current page
      */
-    protected AFPPageState getPageState() {
-        return this.pageState;
+    protected AFPPagePaintingState getPagePaintingState() {
+        return this.pagePaintingState;
     }
 
     /**
@@ -242,7 +241,7 @@
      * @return the current page fonts
      */
     public AFPPageFonts getPageFonts() {
-        return pageState.getFonts();
+        return pagePaintingState.getFonts();
     }
 
     /**
@@ -251,7 +250,7 @@
      * @return the page font count
      */
     public int incrementPageFontCount() {
-        return pageState.incrementFontCount();
+        return pagePaintingState.incrementFontCount();
     }
 
     /**
@@ -260,7 +259,7 @@
      * @param pageWidth the page width
      */
     public void setPageWidth(int pageWidth) {
-        pageState.setWidth(pageWidth);
+        pagePaintingState.setWidth(pageWidth);
     }
 
     /**
@@ -269,7 +268,7 @@
      * @return the page width
      */
     public int getPageWidth() {
-        return pageState.getWidth();
+        return pagePaintingState.getWidth();
     }
 
     /**
@@ -278,7 +277,7 @@
      * @param pageHeight the page height
      */
     public void setPageHeight(int pageHeight) {
-        pageState.setHeight(pageHeight);
+        pagePaintingState.setHeight(pageHeight);
     }
 
     /**
@@ -287,7 +286,7 @@
      * @return the page height
      */
     public int getPageHeight() {
-        return pageState.getHeight();
+        return pagePaintingState.getHeight();
     }
 
     /**
@@ -296,7 +295,7 @@
      * @return the page rotation
      */
     public int getPageRotation() {
-        return pageState.getOrientation();
+        return pagePaintingState.getOrientation();
     }
 
     /**
@@ -337,8 +336,8 @@
 
     /** {@inheritDoc} */
     public Object clone() {
-        AFPState state = (AFPState)super.clone();
-        state.pageState = (AFPPageState)this.pageState.clone();
+        AFPPaintingState state = (AFPPaintingState)super.clone();
+        state.pagePaintingState = (AFPPagePaintingState)this.pagePaintingState.clone();
         state.portraitRotation = this.portraitRotation;
         state.landscapeRotation = this.landscapeRotation;
         state.bitsPerPixel = this.bitsPerPixel;
@@ -349,12 +348,12 @@
 
     /** {@inheritDoc} */
     public String toString() {
-        return "AFPState{" + "portraitRotation=" + portraitRotation
+        return "AFPPaintingState{" + "portraitRotation=" + portraitRotation
         + ", landscapeRotation=" + landscapeRotation
         + ", colorImages=" + colorImages
         + ", bitsPerPixel=" + bitsPerPixel
         + ", resolution=" + resolution
-        + ", pageState=" + pageState
+        + ", pageState=" + pagePaintingState
         + super.toString()
         + "}";
     }
@@ -362,7 +361,7 @@
     /**
      * Page level state data
      */
-    private class AFPPageState implements Cloneable {
+    private class AFPPagePaintingState implements Cloneable {
         /** page width */
         private int width = 0;
 
@@ -461,7 +460,7 @@
 
         /** {@inheritDoc} */
         public Object clone() {
-            AFPPageState state = new AFPPageState();
+            AFPPagePaintingState state = new AFPPagePaintingState();
             state.width = this.width;
             state.height = this.height;
             state.orientation = this.orientation;
@@ -472,7 +471,7 @@
 
         /** {@inheritDoc} */
         public String toString() {
-            return "AFPPageState{width=" + width
+            return "AFPPagePaintingState{width=" + width
             + ", height=" + height
             + ", orientation=" + orientation
             + ", fonts=" + fonts
@@ -484,7 +483,7 @@
     /**
      * Block level state data
      */
-    private class AFPData extends org.apache.fop.AbstractData {
+    private class AFPData extends org.apache.fop.util.AbstractPaintingState.AbstractData {
         private static final long serialVersionUID = -1789481244175275686L;
 
         /** The current fill status */

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPRectanglePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPRectanglePainter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPRectanglePainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPRectanglePainter.java Tue Nov  4 07:30:38 2008
@@ -28,10 +28,10 @@
     /**
      * Main constructor
      *
-     * @param state the afp state
+     * @param state the AFP painting state
      * @param dataStream the afp datastream
      */
-    public AFPRectanglePainter(AFPState state, DataStream dataStream) {
+    public AFPRectanglePainter(AFPPaintingState state, DataStream dataStream) {
         super(state, dataStream);
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceLevel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceLevel.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceLevel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPResourceLevel.java Tue Nov  4 07:30:38 2008
@@ -55,7 +55,7 @@
 
 
     /** where the resource will reside in the AFP output */
-    private int level = PRINT_FILE; // default is print-file level
+    private int level = PRINT_FILE; // default is print-file level (images)
 
     /** the external resource group file path */
     private String extFilePath = null;

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=711273&r1=711272&r2=711273&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 Tue Nov  4 07:30:38 2008
@@ -68,10 +68,10 @@
     /**
      * Sets the outputstream
      *
-     * @param state the afp state
+     * @param state the AFP painting state
      * @param outputStream the outputstream
      */
-    public void createDataStream(AFPState state, OutputStream outputStream) {
+    public void createDataStream(AFPPaintingState state, OutputStream outputStream) {
         this.dataStream = streamer.createDataStream(state);
         streamer.setOutputStream(outputStream);
     }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPStreamer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPStreamer.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPStreamer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPStreamer.java Tue Nov  4 07:30:38 2008
@@ -83,11 +83,11 @@
 
     /**
      * Creates a new DataStream
-     * @param state the afp state
      *
+     * @param state the AFP painting state
      * @return a new {@link DataStream}
      */
-    public DataStream createDataStream(AFPState state) {
+    public DataStream createDataStream(AFPPaintingState state) {
         try {
             this.tempFile = File.createTempFile(AFPDATASTREAM_TEMP_FILE_PREFIX, null);
             this.documentFile = new RandomAccessFile(tempFile, "rw");

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java Tue Nov  4 07:30:38 2008
@@ -71,7 +71,7 @@
         GraphicsObject graphicsObj = g2d.getGraphicsObject();
         Color col = g2d.getColor();
 
-        AFPState state = g2d.getState();
+        AFPPaintingState state = g2d.getPaintingState();
         if (state.setColor(col)) {
             graphicsObj.setColor(col);
         }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPUnitConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPUnitConverter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPUnitConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPUnitConverter.java Tue Nov  4 07:30:38 2008
@@ -29,14 +29,14 @@
 public class AFPUnitConverter {
 
     /** the AFP state */
-    private final AFPState state;
+    private final AFPPaintingState state;
 
     /**
      * Unit converter
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public AFPUnitConverter(AFPState state) {
+    public AFPUnitConverter(AFPPaintingState state) {
         this.state = state;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AbstractAFPPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AbstractAFPPainter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AbstractAFPPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AbstractAFPPainter.java Tue Nov  4 07:30:38 2008
@@ -29,7 +29,7 @@
     protected static Log log = LogFactory.getLog("org.apache.xmlgraphics.afp");
 
     protected final DataStream dataStream;
-    protected final AFPState state;
+    protected final AFPPaintingState state;
 
     /**
      * Main constructor
@@ -37,7 +37,7 @@
      * @param state the afp state
      * @param dataStream the afp datastream
      */
-    public AbstractAFPPainter(AFPState state, DataStream dataStream) {
+    public AbstractAFPPainter(AFPPaintingState state, DataStream dataStream) {
         this.state = state;
         this.dataStream = dataStream;
     }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Factory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Factory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Factory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Factory.java Tue Nov  4 07:30:38 2008
@@ -392,11 +392,11 @@
     /**
      * Creates a new {@link DataStream}
      *
-     * @param state the afp state
+     * @param state the AFP painting state
      * @param outputStream an outputstream to write to
      * @return a new {@link DataStream}
      */
-    public DataStream createDataStream(AFPState state, OutputStream outputStream) {
+    public DataStream createDataStream(AFPPaintingState state, OutputStream outputStream) {
         DataStream dataStream = new DataStream(this, state, outputStream);
         return dataStream;
     }

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java?rev=711273&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java Tue Nov  4 07:30:38 2008
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.batik.bridge.BridgeContext;
+import org.apache.batik.gvt.GraphicsNode;
+import org.apache.fop.image.loader.batik.Graphics2DImagePainterImpl;
+import org.apache.xmlgraphics.java2d.Graphics2DPainterPreparator;
+
+/**
+ * Graphics2DImagePainter implementation for GOCA
+ */
+public class Graphics2DImagePainterGOCA extends Graphics2DImagePainterImpl {
+
+    /**
+     * Main Constructor
+     *
+     * @param root the graphics node root
+     * @param ctx the bridge context
+     * @param imageSize the image size
+     */
+    public Graphics2DImagePainterGOCA(GraphicsNode root, BridgeContext ctx, Dimension imageSize) {
+        super(root, ctx, imageSize);
+    }
+
+    /** {@inheritDoc} */
+    protected Graphics2DPainterPreparator getPreparator() {
+        return new Graphics2DPainterPreparator() {
+
+            /** {@inheritdoc} */
+            public void prepare(Graphics2D g2d, Rectangle2D area) {
+                double tx = area.getX();
+                double ty = area.getHeight() - area.getY();
+                if (tx != 0 || ty != 0) {
+                    g2d.translate(tx, ty);
+                }
+
+                float iw = (float) ctx.getDocumentSize().getWidth();
+                float ih = (float) ctx.getDocumentSize().getHeight();
+                float w = (float) area.getWidth();
+                float h = (float) area.getHeight();
+                float sx = w / iw;
+                float sy = -(h / ih);
+                if (sx != 1.0 || sy != 1.0) {
+                    g2d.scale(sx, sy);
+                }
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java
------------------------------------------------------------------------------
    svn:keywords = Revision Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/ImageContent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/ImageContent.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/ImageContent.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/ImageContent.java Tue Nov  4 07:30:38 2008
@@ -25,6 +25,7 @@
 import org.apache.fop.afp.modca.AbstractStructuredAFPObject;
 
 /**
+ * An IOCA Image Content
  */
 public class ImageContent extends AbstractStructuredAFPObject {
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/DataStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/DataStream.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/DataStream.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/DataStream.java Tue Nov  4 07:30:38 2008
@@ -29,8 +29,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.fop.afp.AFPLineDataInfo;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPResourceLevel;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.afp.AFPTextDataInfo;
 import org.apache.fop.afp.Factory;
 import org.apache.fop.afp.fonts.AFPFont;
@@ -83,17 +83,17 @@
 
     private OutputStream outputStream;
 
-    /** the afp state */
-    private final AFPState state;
+    /** the afp painting state */
+    private final AFPPaintingState state;
 
     /**
      * Default constructor for the AFPDocumentStream.
      *
      * @param factory the resource factory
-     * @param state the afp state
+     * @param state the AFP painting state
      * @param outputStream the outputstream to write to
      */
-    public DataStream(Factory factory, AFPState state, OutputStream outputStream) {
+    public DataStream(Factory factory, AFPPaintingState state, OutputStream outputStream) {
         this.state = state;
         this.factory = factory;
         this.outputStream = outputStream;

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java (from r708877, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/BatikGraphics2DImagePainter.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/BatikGraphics2DImagePainter.java&r1=708877&r2=711273&rev=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/BatikGraphics2DImagePainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java Tue Nov  4 07:30:38 2008
@@ -6,90 +6,59 @@
 
 import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.gvt.GraphicsNode;
-import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
-import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
+import org.apache.fop.render.AbstractGraphics2DImagePainter;
+import org.apache.xmlgraphics.java2d.Graphics2DPainterPreparator;
 
 /**
  * A generic graphics 2D image painter implementation
  */
-public class BatikGraphics2DImagePainter implements Graphics2DImagePainter {
+public class Graphics2DImagePainterImpl extends AbstractGraphics2DImagePainter {
 
-    protected final ImageXMLDOM svg;
     protected final BridgeContext ctx;
-    protected final GraphicsNode root;
+    protected final Dimension imageSize;
 
     /**
-     * Constructor
+     * Main constructor
      *
-     * @param svg the svg image dom
-     * @param ctx the bridge context
      * @param root the graphics node root
+     * @param ctx the bridge context
+     * @param imageSize the image size
      */
-    public BatikGraphics2DImagePainter(ImageXMLDOM svg, BridgeContext ctx, GraphicsNode root) {
-        this.svg = svg;
+    public Graphics2DImagePainterImpl(GraphicsNode root, BridgeContext ctx, Dimension imageSize) {
+        super(root);
+        this.imageSize = imageSize;
         this.ctx = ctx;
-        this.root = root;
-    }
-
-    /**
-     * Initialises the graphics 2d
-     *
-     * @param g2d the graphics 2d
-     * @param area the rectangle drawing area
-     */
-    protected void init(Graphics2D g2d, Rectangle2D area) {
-        // If no viewbox is defined in the svg file, a viewbox of 100x100 is
-        // assumed, as defined in SVGUserAgent.getViewportSize()
-        double tx = area.getX();
-        double ty = area.getY();
-        if (tx != 0 || ty != 0) {
-            g2d.translate(tx, ty);
-        }
-
-        float iw = (float) ctx.getDocumentSize().getWidth();
-        float ih = (float) ctx.getDocumentSize().getHeight();
-        float w = (float) area.getWidth();
-        float h = (float) area.getHeight();
-        float sx = w / iw;
-        float sy = h / ih;
-        if (sx != 1.0 || sy != 1.0) {
-            g2d.scale(sx, sy);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void paint(Graphics2D g2d, Rectangle2D area) {
-        init(g2d, area);
-        root.paint(g2d);
     }
 
     /** {@inheritDoc} */
     public Dimension getImageSize() {
-        return new Dimension(svg.getSize().getWidthMpt(), svg.getSize().getHeightMpt());
+        return imageSize;
     }
 
-    /**
-     * Returns the svg image dom
-     * @return the svg image dom
-     */
-    public ImageXMLDOM getImageXMLDOM() {
-        return svg;
-    }
-
-    /**
-     * Returns the bridge context
-     * @return the bridge context
-     */
-    public BridgeContext getBridgeContext() {
-        return ctx;
-    }
+    /** {@inheritDoc} */
+    protected Graphics2DPainterPreparator getPreparator() {
+        return new Graphics2DPainterPreparator() {
 
-    /**
-     * Returns the graphics root node
-     * @return the graphics root node
-     */
-    public GraphicsNode getRoot() {
-        return root;
+            public void prepare(Graphics2D g2d, Rectangle2D area) {
+                // If no viewbox is defined in the svg file, a viewbox of 100x100 is
+                // assumed, as defined in SVGUserAgent.getViewportSize()
+                double tx = area.getX();
+                double ty = area.getY();
+                if (tx != 0 || ty != 0) {
+                    g2d.translate(tx, ty);
+                }
+
+                float iw = (float) ctx.getDocumentSize().getWidth();
+                float ih = (float) ctx.getDocumentSize().getHeight();
+                float w = (float) area.getWidth();
+                float h = (float) area.getHeight();
+                float sx = w / iw;
+                float sy = h / ih;
+                if (sx != 1.0 || sy != 1.0) {
+                    g2d.scale(sx, sy);
+                }
+            }
+        };
     }
 
 }
\ No newline at end of file

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java Tue Nov  4 07:30:38 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.image.loader.batik;
 
+import java.awt.Dimension;
 import java.awt.geom.AffineTransform;
 import java.util.Map;
 
@@ -33,6 +34,7 @@
 import org.apache.xmlgraphics.image.loader.Image;
 import org.apache.xmlgraphics.image.loader.ImageException;
 import org.apache.xmlgraphics.image.loader.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.ImageProcessingHints;
 import org.apache.xmlgraphics.image.loader.XMLNamespaceEnabledImageFlavor;
 import org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter;
@@ -82,8 +84,14 @@
         }
 
         //Create the painter
-        Graphics2DImagePainter painter = createPainter(svg, ctx, root);
-        ImageGraphics2D g2dImage = new ImageGraphics2D(src.getInfo(), painter);
+        int width = svg.getSize().getWidthMpt();
+        int height = svg.getSize().getHeightMpt();
+        Dimension imageSize = new Dimension(width, height);
+        Graphics2DImagePainter painter = createPainter(ctx, root, imageSize);
+
+        //Create g2d image
+        ImageInfo imageInfo = src.getInfo();
+        ImageGraphics2D g2dImage = new ImageGraphics2D(imageInfo, painter);
         return g2dImage;
     }
 
@@ -109,14 +117,14 @@
     /**
      * Creates a Graphics 2D image painter
      *
-     * @param svg the svg image dom
      * @param ctx the bridge context
      * @param root the graphics node root
+     * @param imageSize the image size
      * @return the newly created graphics 2d image painter
      */
     protected Graphics2DImagePainter createPainter(
-            final ImageXMLDOM svg, final BridgeContext ctx, final GraphicsNode root) {
-        return new BatikGraphics2DImagePainter(svg, ctx, root);
+            BridgeContext ctx, GraphicsNode root, Dimension imageSize) {
+        return new Graphics2DImagePainterImpl(root, ctx, imageSize);
     }
 
     /** {@inheritDoc} */

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java (from r709373, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFState.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFState.java&r1=709373&r2=711273&rev=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFState.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java Tue Nov  4 07:30:38 2008
@@ -25,11 +25,10 @@
 import java.awt.geom.GeneralPath;
 import java.util.Iterator;
 
-import org.apache.fop.AbstractData;
-import org.apache.fop.AbstractState;
+import org.apache.fop.util.AbstractPaintingState;
 
 /**
- * This keeps information about the current state when writing to pdf.
+ * This keeps information about the current painting state when writing to pdf.
  * It allows for creating new graphics states with the q operator.
  * This class is only used to store the information about the state
  * the caller needs to handle the actual pdf operators.
@@ -45,14 +44,14 @@
  * It is impossible to optimise the result without analysing the all
  * the possible combinations after completing.
  */
-public class PDFState extends org.apache.fop.AbstractState {
+public class PDFPaintingState extends org.apache.fop.util.AbstractPaintingState {
 
     private static final long serialVersionUID = 5384726143906371279L;
 
     /**
      * PDF State for storing graphics state.
      */
-    public PDFState() {
+    public PDFPaintingState() {
     }
 
     /**
@@ -162,8 +161,8 @@
     }
 
     /** {@inheritDoc} */
-    protected AbstractState instantiateState() {
-        return new PDFState();
+    protected AbstractPaintingState instantiate() {
+        return new PDFPaintingState();
     }
 
     /**
@@ -178,7 +177,7 @@
         getStateStack().add(copy);
     }
 
-    private class PDFData extends org.apache.fop.AbstractData {
+    private class PDFData extends org.apache.fop.util.AbstractPaintingState.AbstractData {
 
         private static final long serialVersionUID = 3527950647293177764L;
 

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/PDFPaintingState.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Nov  4 07:30:38 2008
@@ -0,0 +1,2 @@
+/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/pdf/PDFState.java:684572,688085,688696
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFState.java:693433-698670,699739,704008-704909,705529-706135,706272-706276,706319-707083,707627,707631-708012,708192-708851

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java Tue Nov  4 07:30:38 2008
@@ -21,9 +21,7 @@
 
 // Java
 import java.awt.Dimension;
-import java.awt.Graphics2D;
 import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 
 import org.apache.batik.bridge.BridgeContext;
@@ -31,7 +29,9 @@
 import org.apache.batik.dom.AbstractDocument;
 import org.apache.batik.dom.svg.SVGDOMImplementation;
 import org.apache.batik.gvt.GraphicsNode;
+import org.apache.fop.events.EventBroadcaster;
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.image.loader.batik.Graphics2DImagePainterImpl;
 import org.apache.fop.render.RendererContext.RendererContextWrapper;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
@@ -51,6 +51,9 @@
     protected static final QName CONVERSION_MODE = new QName(
             ExtensionElementMapping.URI, null, "conversion-mode");
 
+    /** "bitmap" value for the "conversion-mode" extension attribute. */
+    protected static final String BITMAP = "bitmap";
+
     /** {@inheritDoc} */
     public void handleXML(RendererContext context,
                 Document doc, String ns) throws Exception {
@@ -61,65 +64,80 @@
     }
 
     /**
-     * Render the SVG document.
+     * Creates a graphics 2D image painter implementation
      *
-     * @param context the renderer context
-     * @param doc the SVG document
-     * @throws IOException In case of an I/O error while painting the image
+     * @param root the batik graphics node root
+     * @param ctx the batik bridge context
+     * @param imageSize the image size
+     * @return a new graphics 2D image painter implementation
      */
-    protected void renderSVGDocument(final RendererContext context,
-            final Document doc) throws IOException {
-        updateRendererContext(context);
+    protected Graphics2DImagePainter createPainter(
+            GraphicsNode root, BridgeContext ctx, Dimension imageSize) {
+        return new Graphics2DImagePainterImpl(root, ctx, imageSize);
+    }
 
-        //Prepare
-        SVGUserAgent ua = new SVGUserAgent(
-                context.getUserAgent(),
-                new AffineTransform());
+    /**
+     * Builds the GVT root
+     *
+     * @param rendererContext the renderer context
+     * @param ctx the batik bridge context
+     * @param doc the document
+     * @return a built GVT root tree
+     */
+    protected GraphicsNode buildGraphicsNode(
+            RendererContext rendererContext, BridgeContext ctx, Document doc) {
         GVTBuilder builder = new GVTBuilder();
-        final BridgeContext ctx = new BridgeContext(ua);
-
-        //Build the GVT tree
         final GraphicsNode root;
         try {
             root = builder.build(ctx, doc);
         } catch (Exception e) {
-            SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
-                    context.getUserAgent().getEventBroadcaster());
+            EventBroadcaster eventBroadcaster
+                = rendererContext.getUserAgent().getEventBroadcaster();
+            SVGEventProducer eventProducer = SVGEventProducer.Provider.get(eventBroadcaster);
             final String uri = getDocumentURI(doc);
             eventProducer.svgNotBuilt(this, e, uri);
-            return;
+            return null;
         }
+        return root;
+    }
 
-        final RendererContextWrapper wrappedContext = RendererContext.wrapRendererContext(context);
+    /**
+     * Render the SVG document.
+     *
+     * @param rendererContext the renderer context
+     * @param doc the SVG document
+     * @throws IOException In case of an I/O error while painting the image
+     */
+    protected void renderSVGDocument(final RendererContext rendererContext,
+            final Document doc) throws IOException {
+        updateRendererContext(rendererContext);
 
-        //Create the painter
-        Graphics2DImagePainter painter = new Graphics2DImagePainter() {
+        //Prepare
+        SVGUserAgent svgUserAgent = new SVGUserAgent(
+                rendererContext.getUserAgent(), new AffineTransform());
+        final BridgeContext bridgeContext = new BridgeContext(svgUserAgent);
+
+        //Build the GVT tree
+        final GraphicsNode root = buildGraphicsNode(rendererContext, bridgeContext, doc);
 
-            public void paint(Graphics2D g2d, Rectangle2D area) {
-                // If no viewbox is defined in the svg file, a viewbox of 100x100 is
-                // assumed, as defined in SVGUserAgent.getViewportSize()
-                float iw = (float) ctx.getDocumentSize().getWidth();
-                float ih = (float) ctx.getDocumentSize().getHeight();
-                float w = (float) area.getWidth();
-                float h = (float) area.getHeight();
-                g2d.scale(w / iw, h / ih);
-
-                root.paint(g2d);
-            }
-
-            public Dimension getImageSize() {
-                return new Dimension(wrappedContext.getWidth(), wrappedContext.getHeight());
-            }
+        final RendererContextWrapper wrappedContext = RendererContext.wrapRendererContext(
+                rendererContext);
 
-        };
+        //Get Image Size
+        final int width = wrappedContext.getWidth();
+        final int height = wrappedContext.getHeight();
+        Dimension imageSize = new Dimension(width, height);
+
+        //Create the painter
+        final Graphics2DImagePainter painter = createPainter(root, bridgeContext, imageSize);
 
         //Let the painter paint the SVG on the Graphics2D instance
-        Graphics2DAdapter adapter = context.getRenderer().getGraphics2DAdapter();
-        adapter.paintImage(painter, context,
-                wrappedContext.getCurrentXPosition(),
-                wrappedContext.getCurrentYPosition(),
-                wrappedContext.getWidth(),
-                wrappedContext.getHeight());
+        Graphics2DAdapter g2dAdapter = rendererContext.getRenderer().getGraphics2DAdapter();
+
+        //Paint the image
+        final int x = wrappedContext.getCurrentXPosition();
+        final int y = wrappedContext.getCurrentYPosition();
+        g2dAdapter.paintImage(painter, rendererContext, x, y, width, height);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java Tue Nov  4 07:30:38 2008
@@ -135,6 +135,7 @@
         g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
             RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
     }
+
     /** {@inheritDoc} */
     public void paintImage(Graphics2DImagePainter painter,
             RendererContext context,

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPAbstractImageFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPAbstractImageFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPAbstractImageFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPAbstractImageFactory.java Tue Nov  4 07:30:38 2008
@@ -24,8 +24,8 @@
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPForeignAttributeReader;
 import org.apache.fop.afp.AFPObjectAreaInfo;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPResourceInfo;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.afp.AFPUnitConverter;
 
 
@@ -37,7 +37,7 @@
     private static final int Y = 1;
 
     /** the AFP state */
-    protected final AFPState state;
+    protected final AFPPaintingState state;
 
     /** foreign attribute reader */
     private final AFPForeignAttributeReader foreignAttributeReader
@@ -46,9 +46,9 @@
     /**
      * Main constructor
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public AFPAbstractImageFactory(AFPState state) {
+    public AFPAbstractImageFactory(AFPPaintingState state) {
         this.state = state;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoFactory.java Tue Nov  4 07:30:38 2008
@@ -26,8 +26,8 @@
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPForeignAttributeReader;
 import org.apache.fop.afp.AFPObjectAreaInfo;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPResourceInfo;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.afp.AFPUnitConverter;
 
 
@@ -38,8 +38,8 @@
     private static final int X = 0;
     private static final int Y = 1;
 
-    /** the AFP state */
-    protected final AFPState state;
+    /** the AFP painting state */
+    protected final AFPPaintingState state;
 
     /** foreign attribute reader */
     private final AFPForeignAttributeReader foreignAttributeReader
@@ -50,7 +50,7 @@
      *
      * @param state the AFP state
      */
-    public AFPDataObjectInfoFactory(AFPState state) {
+    public AFPDataObjectInfoFactory(AFPPaintingState state) {
         this.state = state;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoProvider.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoProvider.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoProvider.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPDataObjectInfoProvider.java Tue Nov  4 07:30:38 2008
@@ -22,7 +22,7 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.fop.afp.AFPState;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.xmlgraphics.image.loader.Image;
 import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
 import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
@@ -33,16 +33,18 @@
  * AFP data object info factory provider
  */
 public class AFPDataObjectInfoProvider {
+
     private final Map/*<AbstractImage,AFPDataObjectInfoFactory>*/ factoryMap
         = new java.util.HashMap/*<AbstractImage,AFPDataObjectInfoFactory>*/();
-    private final AFPState state;
+
+    private final AFPPaintingState state;
 
     /**
      * Main constructor
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public AFPDataObjectInfoProvider(AFPState state) {
+    public AFPDataObjectInfoProvider(AFPPaintingState state) {
         this.state = state;
         init();
     }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java Tue Nov  4 07:30:38 2008
@@ -27,8 +27,9 @@
 
 import org.apache.fop.afp.AFPGraphics2D;
 import org.apache.fop.afp.AFPGraphicsObjectInfo;
+import org.apache.fop.afp.AFPPaintingState;
+import org.apache.fop.afp.AFPResourceInfo;
 import org.apache.fop.afp.AFPResourceManager;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.render.AbstractGraphics2DAdapter;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.render.RendererContext.RendererContextWrapper;
@@ -69,28 +70,32 @@
             RendererContext context,
             int x, int y, int width, int height) throws IOException {
 
-        // get the 'width' and 'height' attributes of the SVG document
-        Dimension dim = painter.getImageSize();
+        AFPInfo afpInfo = AFPSVGHandler.getAFPInfo(context);
 
+        // set resource manager
+        AFPResourceManager resourceManager = afpInfo.getResourceManager();
+        g2d.setResourceManager(resourceManager);
+
+        // set resource information
+        AFPResourceInfo resourceInfo = afpInfo.getResourceInfo();
+        g2d.setResourceInfo(resourceInfo);
+
+        // set painting state
+        AFPPaintingState paintingState = afpInfo.getPaintingState();
+        g2d.setPaintingState(paintingState);
 
-        AFPInfo afpInfo = AFPSVGHandler.getAFPInfo(context);
-        g2d.setResourceManager(afpInfo.getResourceManager());
-        g2d.setResourceInfo(afpInfo.getResourceInfo());
-        g2d.setState(afpInfo.getState());
+        // set graphic context
         g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
 
-//        // scale/convert to afp units
-//        AFPUnitConverter unitConv = state.getUnitConverter();
-//        float scale = unitConv.mpt2units(1);
-
         float fwidth = width / 1000f;
         float fheight = height / 1000f;
-        float imw = (float)dim.getWidth() / 1000f;
-        float imh = (float)dim.getHeight() / 1000f;
+
+        // get the 'width' and 'height' attributes of the SVG document
+        Dimension imageSize = painter.getImageSize();
+        float imw = (float)imageSize.getWidth() / 1000f;
+        float imh = (float)imageSize.getHeight() / 1000f;
         float sx = fwidth / imw;
         float sy = fheight / imh;
-//        float fx = x / 1000f;
-//        float fy = y / 1000f;
         AffineTransform at = new AffineTransform(sx, 0, 0, sy, x, y);
 
         renderer.saveGraphicsState();
@@ -99,26 +104,21 @@
             //Fallback solution: Paint to a BufferedImage
             int resolution = Math.round(context.getUserAgent().getTargetResolution());
             RendererContextWrapper ctx = RendererContext.wrapRendererContext(context);
-            BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false);
+            BufferedImage bufferedImage = paintToBufferedImage(painter, ctx, resolution, false, false);
 
-            AFPState state = afpInfo.getState();
+            AFPPaintingState state = afpInfo.getPaintingState();
             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);
-                }
             }
 
+            if (!at.isIdentity()) {
+                trans.concatenate(at);
+            }
 
-            // concatenate to transformation matrix
-//            state.concatenate(at);
-
-            // draw image using current transformation matrix
-//            at = state.getData().getTransform();
-            g2d.drawImage(bi, trans, null);
+            g2d.drawImage(bufferedImage, trans, null);
         } else {
             AFPGraphicsObjectInfo graphicsObjectInfo = new AFPGraphicsObjectInfo();
             graphicsObjectInfo.setPainter(painter);
@@ -126,8 +126,6 @@
 
             Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
             graphicsObjectInfo.setArea(area);
-            AFPResourceManager resourceManager = (AFPResourceManager)context.getProperty(
-                    AFPRendererContextConstants.AFP_RESOURCE_MANAGER);
             resourceManager.createObject(graphicsObjectInfo);
         }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageGraphics2DFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageGraphics2DFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageGraphics2DFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageGraphics2DFactory.java Tue Nov  4 07:30:38 2008
@@ -19,10 +19,8 @@
 
 package org.apache.fop.render.afp;
 
-import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 
 import org.apache.batik.bridge.BridgeContext;
@@ -30,16 +28,16 @@
 import org.apache.fop.afp.AFPGraphics2D;
 import org.apache.fop.afp.AFPGraphicsObjectInfo;
 import org.apache.fop.afp.AFPObjectAreaInfo;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPResourceInfo;
 import org.apache.fop.afp.AFPResourceLevel;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.afp.AFPTextElementBridge;
 import org.apache.fop.afp.AFPTextHandler;
 import org.apache.fop.afp.AFPTextPainter;
-import org.apache.fop.image.loader.batik.BatikGraphics2DImagePainter;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.svg.SVGUserAgent;
 import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
+import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
 import org.apache.xmlgraphics.util.MimeConstants;
 
 
@@ -51,9 +49,9 @@
     /**
      * Main constructor
      *
-     * @param state the afp state
+     * @param state the AFP painting state
      */
-    public AFPImageGraphics2DFactory(AFPState state) {
+    public AFPImageGraphics2DFactory(AFPPaintingState state) {
         super(state);
     }
 
@@ -62,8 +60,6 @@
         return new AFPGraphicsObjectInfo();
     }
 
-    private static final AFPResourceLevel inlineResourceLevel = new AFPResourceLevel(AFPResourceLevel.INLINE);
-
     /** {@inheritDoc} */
     public AFPDataObjectInfo create(AFPRendererImageInfo rendererImageInfo) throws IOException {
         AFPGraphicsObjectInfo graphicsObjectInfo
@@ -73,7 +69,7 @@
         // level not explicitly set/changed so default to inline for GOCA graphic objects
         // (due to a bug in the IBM AFP Workbench Viewer (2.04.01.07) - hard copy works just fine)
         if (!resourceInfo.levelChanged()) {
-            resourceInfo.setLevel(inlineResourceLevel);
+            resourceInfo.setLevel(new AFPResourceLevel(AFPResourceLevel.INLINE));
         }
 
         // set mime type (unsupported by MOD:CA registry)
@@ -89,7 +85,7 @@
         AFPInfo afpInfo = AFPSVGHandler.getAFPInfo(rendererContext);
         g2d.setResourceManager(afpInfo.getResourceManager());
         g2d.setResourceInfo(afpInfo.getResourceInfo());
-        g2d.setState(afpInfo.getState());
+        g2d.setPaintingState(afpInfo.getPaintingState());
         g2d.setFontInfo(afpInfo.getFontInfo());
 
         // set to default graphic context
@@ -100,7 +96,7 @@
         g2d.translate(at.getTranslateX(), at.getTranslateY());
 
         // set afp state
-        g2d.setState(state);
+        g2d.setPaintingState(state);
 
         // controls whether text painted by Batik is generated using text or path operations
         SVGUserAgent svgUserAgent
@@ -117,49 +113,23 @@
 
         // set painter
         ImageGraphics2D imageG2D = (ImageGraphics2D)rendererImageInfo.getImage();
-        BatikGraphics2DImagePainter painter
-            = (BatikGraphics2DImagePainter)imageG2D.getGraphics2DImagePainter();
-        painter = new AFPGraphics2DImagePainter(painter);
-        imageG2D.setGraphics2DImagePainter(painter);
+        Graphics2DImagePainter painter = imageG2D.getGraphics2DImagePainter();
         graphicsObjectInfo.setPainter(painter);
 
         // set object area
         AFPObjectAreaInfo objectAreaInfo = graphicsObjectInfo.getObjectAreaInfo();
-        Rectangle area = new Rectangle(objectAreaInfo.getWidth(), objectAreaInfo.getHeight());
+        int width = objectAreaInfo.getWidth();
+        int height = objectAreaInfo.getHeight();
+        Rectangle area = new Rectangle(width, height);
         graphicsObjectInfo.setArea(area);
 
-        return graphicsObjectInfo;
-    }
-
-    private class AFPGraphics2DImagePainter extends BatikGraphics2DImagePainter {
-        /**
-         * Copy constructor
-         *
-         * @param painter a graphics 2D image painter
-         */
-        public AFPGraphics2DImagePainter(BatikGraphics2DImagePainter painter) {
-            super(painter.getImageXMLDOM(), painter.getBridgeContext(), painter.getRoot());
-        }
-
-        /** {@inheritDoc} */
-        protected void init(Graphics2D g2d, Rectangle2D area) {
-            double tx = area.getX();
-            double ty = area.getHeight() - area.getY();
-            if (tx != 0 || ty != 0) {
-                g2d.translate(tx, ty);
-            }
-
-            float iw = (float) ctx.getDocumentSize().getWidth();
-            float ih = (float) ctx.getDocumentSize().getHeight();
-            float w = (float) area.getWidth();
-            float h = (float) area.getHeight();
-            float sx = w / iw;
-            float sy = -(h / ih);
-            if (sx != 1.0 || sy != 1.0) {
-                g2d.scale(sx, sy);
-            }
-        }
+        // invert y-axis for GOCA
+        final int sx = 1;
+        final int sy = -1;
+        g2d.translate(0, height);
+        g2d.scale(sx, sy);
 
+        return graphicsObjectInfo;
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRawStreamFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRawStreamFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRawStreamFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRawStreamFactory.java Tue Nov  4 07:30:38 2008
@@ -24,7 +24,7 @@
 
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPObjectAreaInfo;
-import org.apache.fop.afp.AFPState;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
 
@@ -36,9 +36,9 @@
     /**
      * Main constructor
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public AFPImageRawStreamFactory(AFPState state) {
+    public AFPImageRawStreamFactory(AFPPaintingState state) {
         super(state);
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRenderedFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRenderedFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRenderedFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageRenderedFactory.java Tue Nov  4 07:30:38 2008
@@ -26,7 +26,7 @@
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPImageObjectInfo;
 import org.apache.fop.afp.AFPObjectAreaInfo;
-import org.apache.fop.afp.AFPState;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
 import org.apache.xmlgraphics.ps.ImageEncodingHelper;
 import org.apache.xmlgraphics.util.MimeConstants;
@@ -39,9 +39,9 @@
     /**
      * Main constructor
      *
-     * @param state the AFP state
+     * @param state the AFP painting state
      */
-    public AFPImageRenderedFactory(AFPState state) {
+    public AFPImageRenderedFactory(AFPPaintingState state) {
         super(state);
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPInfo.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPInfo.java Tue Nov  4 07:30:38 2008
@@ -20,9 +20,9 @@
 package org.apache.fop.render.afp;
 
 import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPResourceInfo;
 import org.apache.fop.afp.AFPResourceManager;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.fonts.FontInfo;
 
 /**
@@ -48,7 +48,7 @@
     private FontInfo fontInfo;
 
     /** See AFP_STATE */
-    private AFPState state;
+    private AFPPaintingState state;
 
     /** See AFP_RESOURCE_MANAGER */
     private AFPResourceManager resourceManager;
@@ -127,7 +127,7 @@
      *
      * @return the current AFP state
      */
-    public AFPState getState() {
+    public AFPPaintingState getPaintingState() {
         return this.state;
     }
 
@@ -146,7 +146,7 @@
      * @return true if supports color
      */
     public boolean isColorSupported() {
-        return getState().isColorImages();
+        return getPaintingState().isColorImages();
     }
 
     /**
@@ -173,7 +173,7 @@
      * @return the resolution
      */
     protected int getResolution() {
-        return getState().getResolution();
+        return getPaintingState().getResolution();
     }
 
     /**
@@ -181,7 +181,7 @@
      * @return the number of bits per pixel to use
      */
     protected int getBitsPerPixel() {
-        return getState().getBitsPerPixel();
+        return getPaintingState().getBitsPerPixel();
     }
 
     /**
@@ -216,7 +216,7 @@
      *
      * @param state the AFP state
      */
-    public void setState(AFPState state) {
+    public void setPaintingState(AFPPaintingState state) {
         this.state = state;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRawCCITTFaxFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRawCCITTFaxFactory.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRawCCITTFaxFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRawCCITTFaxFactory.java Tue Nov  4 07:30:38 2008
@@ -24,7 +24,7 @@
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPImageObjectInfo;
 import org.apache.fop.afp.AFPObjectAreaInfo;
-import org.apache.fop.afp.AFPState;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
 
 /**
@@ -35,9 +35,9 @@
     /**
      * Main constructor
      *
-     * @param state the afp state
+     * @param state the AFP painting state
      */
-    public AFPRawCCITTFaxFactory(AFPState state) {
+    public AFPRawCCITTFaxFactory(AFPPaintingState state) {
         super(state);
     }
 

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=711273&r1=711272&r2=711273&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 Tue Nov  4 07:30:38 2008
@@ -33,14 +33,13 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.fop.AbstractState;
 import org.apache.fop.afp.AFPBorderPainter;
 import org.apache.fop.afp.AFPConstants;
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPPageFonts;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPRectanglePainter;
 import org.apache.fop.afp.AFPResourceManager;
-import org.apache.fop.afp.AFPState;
 import org.apache.fop.afp.AFPTextDataInfo;
 import org.apache.fop.afp.AFPUnitConverter;
 import org.apache.fop.afp.BorderPaintInfo;
@@ -72,6 +71,7 @@
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.render.afp.extensions.AFPElementMapping;
 import org.apache.fop.render.afp.extensions.AFPPageSetup;
+import org.apache.fop.util.AbstractPaintingState;
 import org.apache.xmlgraphics.image.loader.ImageException;
 import org.apache.xmlgraphics.image.loader.ImageFlavor;
 import org.apache.xmlgraphics.image.loader.ImageInfo;
@@ -146,8 +146,8 @@
     /** resource manager */
     private AFPResourceManager resourceManager;
 
-    /** drawing state */
-    private final AFPState state;
+    /** painting state */
+    private final AFPPaintingState paintingState;
 
     /** unit converter */
     private final AFPUnitConverter unitConv;
@@ -175,9 +175,9 @@
     public AFPRenderer() {
         super();
         this.resourceManager = new AFPResourceManager();
-        this.state = new AFPState();
-        this.dataObjectInfoProvider = new AFPDataObjectInfoProvider(state);
-        this.unitConv = state.getUnitConverter();
+        this.paintingState = new AFPPaintingState();
+        this.dataObjectInfoProvider = new AFPDataObjectInfoProvider(paintingState);
+        this.unitConv = paintingState.getUnitConverter();
     }
 
     /** {@inheritDoc} */
@@ -197,13 +197,13 @@
 
     /** {@inheritDoc} */
     public void startRenderer(OutputStream outputStream) throws IOException {
-        state.setColor(Color.WHITE);
+        paintingState.setColor(Color.WHITE);
 
-        resourceManager.createDataStream(state, outputStream);
+        resourceManager.createDataStream(paintingState, outputStream);
 
         this.dataStream = resourceManager.getDataStream();
-        this.borderPainter = new AFPBorderPainter(state, dataStream);
-        this.rectanglePainter = new AFPRectanglePainter(state, dataStream);
+        this.borderPainter = new AFPBorderPainter(paintingState, dataStream);
+        this.rectanglePainter = new AFPRectanglePainter(paintingState, dataStream);
 
         dataStream.startDocument();
     }
@@ -231,10 +231,10 @@
 
     /** {@inheritDoc} */
     public void preparePage(PageViewport page) {
-        int pageRotation = state.getPageRotation();
-        int pageWidth = state.getPageWidth();
-        int pageHeight = state.getPageHeight();
-        int resolution = state.getResolution();
+        int pageRotation = paintingState.getPageRotation();
+        int pageWidth = paintingState.getPageWidth();
+        int pageHeight = paintingState.getPageHeight();
+        int resolution = paintingState.getResolution();
         dataStream.startPage(pageWidth, pageHeight, pageRotation,
                 resolution, resolution);
 
@@ -278,7 +278,7 @@
     /** {@inheritDoc} */
     protected void concatenateTransformationMatrix(AffineTransform at) {
         if (!at.isIdentity()) {
-            state.concatenate(at);
+            paintingState.concatenate(at);
         }
     }
 
@@ -296,12 +296,12 @@
 
     /** {@inheritDoc} */
     public void renderPage(PageViewport pageViewport) throws IOException, FOPException {
-        state.clear();
+        paintingState.clear();
 
         Rectangle2D bounds = pageViewport.getViewArea();
 
         AffineTransform baseTransform = getBaseTransform();
-        state.concatenate(baseTransform);
+        paintingState.concatenate(baseTransform);
 
         if (pages.containsKey(pageViewport)) {
             dataStream.restorePage(
@@ -309,15 +309,15 @@
         } else {
             int pageWidth
                 = Math.round(unitConv.mpt2units((float)bounds.getWidth()));
-            state.setPageWidth(pageWidth);
+            paintingState.setPageWidth(pageWidth);
 
             int pageHeight
                 = Math.round(unitConv.mpt2units((float)bounds.getHeight()));
-            state.setPageHeight(pageHeight);
+            paintingState.setPageHeight(pageHeight);
 
-            int pageRotation = state.getPageRotation();
+            int pageRotation = paintingState.getPageRotation();
 
-            int resolution = state.getResolution();
+            int resolution = paintingState.getResolution();
 
             dataStream.startPage(pageWidth, pageHeight, pageRotation,
                     resolution, resolution);
@@ -327,7 +327,7 @@
 
         super.renderPage(pageViewport);
 
-        AFPPageFonts pageFonts = state.getPageFonts();
+        AFPPageFonts pageFonts = paintingState.getPageFonts();
         if (pageFonts != null && !pageFonts.isEmpty()) {
             dataStream.addFontsToCurrentPage(pageFonts);
         }
@@ -389,24 +389,22 @@
                 this.fontInfo);
         context.setProperty(AFPRendererContextConstants.AFP_RESOURCE_MANAGER,
                 this.resourceManager);
-        context.setProperty(AFPRendererContextConstants.AFP_STATE, state);
+        context.setProperty(AFPRendererContextConstants.AFP_PAINTING_STATE, paintingState);
         return context;
     }
 
     private static final ImageFlavor[] NATIVE_FLAVORS = new ImageFlavor[] {
         /*ImageFlavor.RAW_PNG, */ // PNG not natively supported in AFP
-        ImageFlavor.RAW_JPEG, ImageFlavor.RAW_CCITTFAX, ImageFlavor.RAW_EPS,
-        ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE,
-        ImageFlavor.XML_DOM };
+        ImageFlavor.XML_DOM, ImageFlavor.RAW_JPEG, ImageFlavor.RAW_CCITTFAX, ImageFlavor.RAW_EPS,
+        ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE };
 
     private static final ImageFlavor[] FLAVORS = new ImageFlavor[] {
-        ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE,
-        ImageFlavor.XML_DOM };
+        ImageFlavor.XML_DOM, ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE };
 
     /** {@inheritDoc} */
     public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
         uri = URISpecification.getURL(uri);
-        state.setImageUri(uri);
+        paintingState.setImageUri(uri);
         Rectangle posInt = new Rectangle((int) pos.getX(), (int) pos.getY(),
                 (int) pos.getWidth(), (int) pos.getHeight());
         String name = (String)pageSegmentMap.get(uri);
@@ -427,7 +425,7 @@
                 // Only now fully load/prepare the image
                 Map hints = ImageUtil.getDefaultHints(sessionContext);
 
-                ImageFlavor[] flavors = state.isNativeImages() ? NATIVE_FLAVORS : FLAVORS;
+                ImageFlavor[] flavors = paintingState.isNativeImages() ? NATIVE_FLAVORS : FLAVORS;
                 org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
                         info, flavors, hints, sessionContext);
 
@@ -501,30 +499,30 @@
     /** {@inheritDoc} */
     public void updateColor(Color col, boolean fill) {
         if (fill) {
-            state.setColor(col);
+            paintingState.setColor(col);
         }
     }
 
     /** {@inheritDoc} */
     public void restoreStateStackAfterBreakOut(List breakOutList) {
         log.debug("Block.FIXED --> restoring context after break-out");
-        state.pushAll(breakOutList);
+        paintingState.pushAll(breakOutList);
     }
 
     /** {@inheritDoc} */
     protected List breakOutOfStateStack() {
         log.debug("Block.FIXED --> break out");
-        return state.popAll();
+        return paintingState.popAll();
     }
 
     /** {@inheritDoc} */
     public void saveGraphicsState() {
-        state.push();
+        paintingState.push();
     }
 
     /** {@inheritDoc} */
     public void restoreGraphicsState() {
-        state.pop();
+        paintingState.pop();
     }
 
     /** Indicates the beginning of a text object. */
@@ -549,7 +547,7 @@
         renderInlineAreaBackAndBorders(text);
 
         int fontSize = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
-        state.setFontSize(fontSize);
+        paintingState.setFontSize(fontSize);
 
         String name = getInternalFontNameForArea(text);
         AFPFont font = (AFPFont)fontInfo.getFonts().get(name);
@@ -561,10 +559,10 @@
         AFPFontAttributes fontAttributes
             = new AFPFontAttributes(name, font, fontSize);
 
-        AFPPageFonts pageFonts = state.getPageFonts();
+        AFPPageFonts pageFonts = paintingState.getPageFonts();
         if (!pageFonts.containsKey(fontAttributes.getFontKey())) {
             // Font not found on current page, so add the new one
-            fontAttributes.setFontReference(state.incrementPageFontCount());
+            fontAttributes.setFontReference(paintingState.incrementPageFontCount());
             pageFonts.put(fontAttributes.getFontKey(), fontAttributes);
         } else {
             // Use the previously stored font attributes
@@ -727,7 +725,7 @@
      *            The rotation in degrees.
      */
     public void setPortraitRotation(int rotation) {
-        state.setPortraitRotation(rotation);
+        paintingState.setPortraitRotation(rotation);
     }
 
     /**
@@ -738,7 +736,7 @@
      *            The rotation in degrees.
      */
     public void setLandscapeRotation(int rotation) {
-        state.setLandscapeRotation(rotation);
+        paintingState.setLandscapeRotation(rotation);
     }
 
     /**
@@ -748,7 +746,7 @@
      *            number of bits per pixel
      */
     public void setBitsPerPixel(int bitsPerPixel) {
-        state.setBitsPerPixel(bitsPerPixel);
+        paintingState.setBitsPerPixel(bitsPerPixel);
     }
 
     /**
@@ -758,7 +756,7 @@
      *            color image output
      */
     public void setColorImages(boolean colorImages) {
-        state.setColorImages(colorImages);
+        paintingState.setColorImages(colorImages);
     }
 
     /**
@@ -768,7 +766,7 @@
      *            native image support
      */
     public void setNativeImages(boolean nativeImages) {
-        state.setNativeImages(nativeImages);
+        paintingState.setNativeImages(nativeImages);
     }
 
     /**
@@ -778,7 +776,7 @@
      *            the output resolution (dpi)
      */
     public void setResolution(int resolution) {
-        state.setResolution(resolution);
+        paintingState.setResolution(resolution);
     }
 
     /**
@@ -787,7 +785,7 @@
      * @return the resolution in dpi
      */
     public int getResolution() {
-        return state.getResolution();
+        return paintingState.getResolution();
     }
 
     /**
@@ -795,8 +793,8 @@
      *
      * @return the current AFP state
      */
-    public AbstractState getState() {
-        return this.state;
+    public AbstractPaintingState getState() {
+        return this.paintingState;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java?rev=711273&r1=711272&r2=711273&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java Tue Nov  4 07:30:38 2008
@@ -38,6 +38,6 @@
     /** The afp resource manager */
     String AFP_RESOURCE_MANAGER = "afpResourceManager";
 
-    /** The afp state */
-    String AFP_STATE = "afpPageState";
+    /** The afp painting state */
+    String AFP_PAINTING_STATE = "afpPaintingState";
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org