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/13 17:12:00 UTC

svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Author: acumiskey
Date: Thu Nov 13 08:11:58 2008
New Revision: 713747

URL: http://svn.apache.org/viewvc?rev=713747&view=rev
Log:
* PDFImageHandler interface split into ImageHandler and PDFImageHandler.
* Deleted AFPDataObjectInfoProvider and AFPImage*Factory implementations, and abstracted AbstractImageHandlerRegistry from PDFImageHandlerRegistry, creating AFPImageHandlerRegistry and AFPImageHandler so there is a common reuse of image handling implementation between AFP and PDF now.
* RendererContext instantiation is now overridable in PrintRenderer.
* Created AFPRendererContext that is able to provide AFPInfo.
* toString() added to RendererContext for ease of use.
* Removed GraphicsObjectPainterAFP.
* Added package.html for AFP (sub)packages.
* Abstracted AbstractFOPBridgeContext from PDFBridgeContext and provided AFPBridgeContext implementation.
* Abstracted AbstractFOPTextElementBridge from PDFTextElementBridge and provided AFPTextElementBridge implementation.
* Abstracted AbstractFOPImageElementBridge from PDFImageElementBridge and provided AFPImageElementBridge implementation.
* Provided inline image support/handling in AFPGraphics2D for SVG.
* Created NativeImageHandler interface.
* Fix for path iterator filled line drawing in AFPGraphics2D adding coordinate drawing implementations GraphicsLineRelative and GraphicsFilletRelative (Thanks for the patch Jeremias).
* Improved configuration.xml documentation for images mode/native setting in AFP renderer configuration.

Added:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java
      - copied, changed from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPageFonts.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsFilletRelative.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLineRelative.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java
      - copied, changed from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextElementBridge.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextHandler.java
      - copied, changed from r711563, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextPainter.java
      - copied, changed from r711563, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextPainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractImageHandlerRegistry.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ImageHandler.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java
      - copied, changed from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPForeignAttributeReader.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandler.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerRawCCITTFax.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerRegistry.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPImageHandlerXML.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererContext.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java   (with props)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/NativeImageHandler.java   (with props)
Removed:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPForeignAttributeReader.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPageFonts.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextElementBridge.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/AFPTextPainter.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/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/AFPRawCCITTFaxFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/GraphicsObjectPainterAFP.java
Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/trunk/configuration.xml
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphics2D.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.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/AFPStreamer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLine.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/fonts/FontInfo.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/package.html
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/package.html
    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/PrintRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/RendererContext.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/AFPInfo.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/AFPRendererConfigurator.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererImageInfo.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/pdf/PDFImageHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerRegistry.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFImageHandlerXML.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/ps/PSTextPainter.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFBridgeContext.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFImageElementBridge.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextElementBridge.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextPainter.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/trunk/configuration.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/trunk/configuration.xml?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/trunk/configuration.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/trunk/configuration.xml Thu Nov 13 08:11:58 2008
@@ -383,7 +383,8 @@
   <resource-group-file>resources.afp</resource-group-file>
 </renderer>]]></source>
       <p>
-        The default value for the "images mode" setting is "b+w" (black and white).  When the setting is "color" a "bits-per-pixel" setting can be provided.  When the setting "native" is set to true, images (TIFF, JPEG and Encapsulated Postscript) will be placed in the datastream in their native form using a MO:DCA Object Container.
+        The default value for the images "mode" setting is "b+w" (black and white).  When the images "mode" setting is "b+w" a "bits-per-pixel" setting can be provided to aid the grayscale conversion process.  With this setting all images referenced in your source document are converted to an IOCA FS45 grayscale bitmap image form. 
+        When the setting is "color" all images are converted to an IOCA FS45 color bitmap image form.  When "native" setting is "true", all images encountered (TIFF, GIF, JPEG and Encapsulated Postscript etc.) will be embedded directly in the datastream in their native form using a MO:DCA Object Container.
       </p>
       <p>
         The default value for the "renderer-resolution" is 240 dpi. 

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler Thu Nov 13 08:11:58 2008
@@ -0,0 +1,5 @@
+org.apache.fop.render.afp.AFPImageHandlerRenderedImage
+org.apache.fop.render.afp.AFPImageHandlerRawCCITTFax
+org.apache.fop.render.afp.AFPImageHandlerRawStream
+org.apache.fop.render.afp.AFPImageHandlerGraphics2D
+org.apache.fop.render.afp.AFPImageHandlerXML

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -48,6 +48,7 @@
 import org.apache.fop.afp.goca.GraphicsSetLineType;
 import org.apache.fop.afp.modca.GraphicsObject;
 import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.svg.NativeImageHandler;
 import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.ImageSize;
 import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
@@ -65,7 +66,7 @@
  *
  * @see org.apache.xmlgraphics.java2d.AbstractGraphics2D
  */
-public class AFPGraphics2D extends AbstractGraphics2D {
+public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHandler {
 
     private static final Log log = LogFactory.getLog(AFPGraphics2D.class);
 
@@ -109,10 +110,19 @@
      * @param textAsShapes
      *            if true, all text is turned into shapes in the convertion. No
      *            text is output.
-     *
-     */
-    public AFPGraphics2D(boolean textAsShapes) {
+     * @param paintingState painting state
+     * @param resourceManager resource manager
+     * @param resourceInfo resource info
+     * @param fontInfo font info
+     */
+    public AFPGraphics2D(boolean textAsShapes, AFPPaintingState paintingState,
+            AFPResourceManager resourceManager, AFPResourceInfo resourceInfo,
+            FontInfo fontInfo) {
         super(textAsShapes);
+        this.paintingState = paintingState;
+        this.resourceManager = resourceManager;
+        this.resourceInfo = resourceInfo;
+        this.fontInfo = fontInfo;
     }
 
     /**
@@ -123,12 +133,14 @@
      */
     public AFPGraphics2D(AFPGraphics2D g2d) {
         super(g2d);
+        this.paintingState = g2d.paintingState;
+        this.resourceManager = g2d.resourceManager;
+        this.resourceInfo = g2d.resourceInfo;
+        this.fontInfo = g2d.fontInfo;
+
         this.graphicsObj = g2d.graphicsObj;
         this.fallbackTextHandler = g2d.fallbackTextHandler;
         this.customTextHandler = g2d.customTextHandler;
-        this.resourceManager = g2d.resourceManager;
-        this.resourceInfo = g2d.resourceInfo;
-        this.paintingState = g2d.paintingState;
     }
 
     /**
@@ -282,16 +294,13 @@
                     mhr
             );
         } else {
-            // graphics segment opening coordinates (x,y)
-            // current position coordinates (x,y)
             for (int[] openingCoords = new int[2], currCoords = new int[2];
                 !iter.isDone(); iter.next()) {
-                // round the coordinate values and combine with current position
-                // coordinates
                 int type = iter.currentSegment(dstPts);
                 if (type == PathIterator.SEG_MOVETO) {
                     openingCoords[X] = currCoords[X] = (int)Math.round(dstPts[X]);
                     openingCoords[Y] = currCoords[Y] = (int)Math.round(dstPts[Y]);
+                    graphicsObj.setCurrentPosition(openingCoords);
                 } else {
                     int numCoords;
                     if (type == PathIterator.SEG_LINETO) {
@@ -303,32 +312,22 @@
                     } else {
                         // close of the graphics segment
                         if (type == PathIterator.SEG_CLOSE) {
-                            coords = new int[] {
-                                    coords[coords.length - 2], //prev X
-                                    coords[coords.length - 1], //prev Y
-                                    openingCoords[X],
-                                    openingCoords[Y]
-                            };
-                            graphicsObj.addLine(coords);
+                            graphicsObj.addLine(openingCoords, true);
                         } else {
                             log.debug("Unrecognised path iterator type: "
                                     + type);
                         }
                         continue;
                     }
-                    // combine current position coordinates with new graphics
-                    // segment coordinates
-                    coords = new int[numCoords + 2];
-                    coords[X] = currCoords[X];
-                    coords[Y] = currCoords[Y];
+                    coords = new int[numCoords];
                     for (int i = 0; i < numCoords; i++) {
-                        coords[i + 2] = (int) Math.round(dstPts[i]);
+                        coords[i] = (int) Math.round(dstPts[i]);
                     }
                     if (type == PathIterator.SEG_LINETO) {
-                        graphicsObj.addLine(coords);
+                        graphicsObj.addLine(coords, true);
                     } else if (type == PathIterator.SEG_QUADTO
                             || type == PathIterator.SEG_CUBICTO) {
-                        graphicsObj.addFillet(coords);
+                        graphicsObj.addFillet(coords, true);
                     }
                     // update current position coordinates
                     currCoords[X] = coords[coords.length - 2];
@@ -408,7 +407,7 @@
                                  BufferedImage.TYPE_INT_ARGB);
     }
 
-    private AFPImageObjectInfo getImageObjectInfo(
+    private AFPImageObjectInfo createImageObjectInfo(
             RenderedImage img, int x, int y, int width, int height) throws IOException {
         ImageInfo imageInfo = new ImageInfo(null, "image/unknown");
         ImageSize size = new ImageSize(img.getWidth(), img.getHeight(), 72);
@@ -422,7 +421,8 @@
 
         imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45);
 
-        imageObjectInfo.setBitsPerPixel(paintingState.getBitsPerPixel());
+        int bitsPerPixel = paintingState.getBitsPerPixel();
+        imageObjectInfo.setBitsPerPixel(bitsPerPixel);
 
         imageObjectInfo.setResourceInfo(resourceInfo);
 
@@ -442,7 +442,6 @@
         // convert to grayscale
         if (!colorImages) {
             boas.reset();
-            int bitsPerPixel = paintingState.getBitsPerPixel();
             imageObjectInfo.setBitsPerPixel(bitsPerPixel);
             ImageEncodingHelper.encodeRGBAsGrayScale(
                   imageData, dataWidth, dataHeight, bitsPerPixel, boas);
@@ -456,21 +455,10 @@
 
         // create object area info
         AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo();
-
-        AffineTransform at = gc.getTransform();
-        float[] srcPts = new float[] {x, y};
-        float[] dstPts = new float[srcPts.length];
-        at.transform(srcPts, 0, dstPts, 0, 1);
-        objectAreaInfo.setX(Math.round(dstPts[X]));
-        objectAreaInfo.setY(Math.round(dstPts[Y]));
-
-        AFPUnitConverter unitConv = paintingState.getUnitConverter();
-
-        int w = Math.round(unitConv.pt2units(width));
-        objectAreaInfo.setWidth(w);
-
-        int h = Math.round(unitConv.pt2units(height));
-        objectAreaInfo.setHeight(h);
+        objectAreaInfo.setX(x);
+        objectAreaInfo.setY(y);
+        objectAreaInfo.setWidth(width);
+        objectAreaInfo.setHeight(height);
 
         int resolution = paintingState.getResolution();
         objectAreaInfo.setWidthRes(resolution);
@@ -481,37 +469,62 @@
         return imageObjectInfo;
     }
 
-    /** {@inheritDoc} */
-    public boolean drawImage(Image img, int x, int y, int width, int height,
-            ImageObserver observer) {
-
-        // draw with AWT Graphics2D
-        Dimension size = new Dimension(width, height);
-        BufferedImage bufferedImage = buildBufferedImage(size);
+    /**
+     * Draws an AWT image into a BufferedImage using an AWT Graphics2D implementation
+     *
+     * @param img the AWT image
+     * @param bufferedImage the AWT buffered image
+     * @param width the image width
+     * @param height the image height
+     * @param observer the image observer
+     * @return true if the image was drawn
+     */
+    private boolean drawBufferedImage(Image img, BufferedImage bufferedImage,
+            int width, int height, ImageObserver observer) {
 
         java.awt.Graphics2D g2d = bufferedImage.createGraphics();
-        g2d.setComposite(AlphaComposite.SrcOver);
+        try {
+            g2d.setComposite(AlphaComposite.SrcOver);
+
+            Color color = new Color(1, 1, 1, 0);
+            g2d.setBackground(color);
+            g2d.setPaint(color);
 
-        Color color = new Color(1, 1, 1, 0);
-        g2d.setBackground(color);
-        g2d.setPaint(color);
+            g2d.fillRect(0, 0, width, height);
 
-        g2d.fillRect(0, 0, width, height);
+            int imageWidth = bufferedImage.getWidth();
+            int imageHeight = bufferedImage.getHeight();
+            Rectangle clipRect = new Rectangle(0, 0, imageWidth, imageHeight);
+            g2d.clip(clipRect);
 
-        int imageWidth = bufferedImage.getWidth();
-        int imageHeight = bufferedImage.getHeight();
-        Rectangle clipRect = new Rectangle(0, 0, imageWidth, imageHeight);
-        g2d.clip(clipRect);
+            g2d.setComposite(gc.getComposite());
 
-        g2d.setComposite(gc.getComposite());
+            return g2d.drawImage(img, 0, 0, imageWidth, imageHeight, observer);
+        } finally {
+            g2d.dispose(); //drawn so dispose immediately to free system resource
+        }
+    }
 
-        boolean drawn = g2d.drawImage(img, 0, 0, imageWidth, imageHeight, observer);
-        g2d.dispose(); //drawn so dispose immediately to free system resource
+    /** {@inheritDoc} */
+    public boolean drawImage(Image img, int x, int y, int width, int height,
+            ImageObserver observer) {
 
+        // draw with AWT Graphics2D
+        Dimension imageSize = new Dimension(width, height);
+        BufferedImage bufferedImage = buildBufferedImage(imageSize);
+
+        boolean drawn = drawBufferedImage(img, bufferedImage, width, height, observer);
         if (drawn) {
+            AffineTransform at = gc.getTransform();
+            float[] srcPts = new float[] {x, y};
+            float[] dstPts = new float[srcPts.length];
+            at.transform(srcPts, 0, dstPts, 0, 1);
+            x = Math.round(dstPts[X]);
+            y = Math.round(dstPts[Y]);
             try {
                 // get image object info
-                AFPImageObjectInfo imageObjectInfo = getImageObjectInfo(bufferedImage, x, y, width, height);
+                AFPImageObjectInfo imageObjectInfo
+                    = createImageObjectInfo(bufferedImage, x, y, width, height);
 
                 // create image resource
                 resourceManager.createObject(imageObjectInfo);
@@ -524,24 +537,23 @@
     }
 
     /** {@inheritDoc} */
-    public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
-        log.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform);
-    }
-
-    /** {@inheritDoc} */
     public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
-        log.debug("drawRenderedImage() NYI: img=" + img + ", xform=" + xform);
-    }
-
-    /** {@inheritDoc} */
-    public FontMetrics getFontMetrics(Font f) {
-        log.debug("getFontMetrics() NYI: f=" + f);
-        return null;
-    }
+        int width = img.getWidth();
+        int height = img.getHeight();
 
-    /** {@inheritDoc} */
-    public void setXORMode(Color col) {
-        log.debug("setXORMode() NYI: col=" + col);
+        AffineTransform at = paintingState.getData().getTransform();
+        AffineTransform gat = gc.getTransform();
+        int x = (int)Math.round(at.getTranslateX() + gat.getTranslateX());
+        int y = (int)Math.round(at.getTranslateY());
+        try {
+            // get image object info
+            AFPImageObjectInfo imageObjectInfo
+                = createImageObjectInfo(img, x, y, width, height);
+            // create image resource
+            resourceManager.createObject(imageObjectInfo);
+        } catch (IOException ioe) {
+            handleIOException(ioe);
+        }
     }
 
     /**
@@ -609,4 +621,27 @@
     public FontInfo getFontInfo() {
         return this.fontInfo;
     }
+
+    /** {@inheritDoc} */
+    public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
+        log.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform);
+    }
+
+    /** {@inheritDoc} */
+    public FontMetrics getFontMetrics(Font f) {
+        log.debug("getFontMetrics() NYI: f=" + f);
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public void setXORMode(Color col) {
+        log.debug("setXORMode() NYI: col=" + col);
+    }
+
+    /** {@inheritDoc} */
+    public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image,
+            float x, float y, float width, float height) {
+        log.debug("NYI: addNativeImage() "+ "image=" + image
+                + ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height);
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java Thu Nov 13 08:11:58 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.afp;
 
+import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
@@ -62,7 +63,10 @@
      * @return the graphics area
      */
     public Rectangle2D getArea() {
-        return this.area;
+        AFPObjectAreaInfo objectAreaInfo = getObjectAreaInfo();
+        int width = objectAreaInfo.getWidth();
+        int height = objectAreaInfo.getHeight();
+        return new Rectangle(width, height);
     }
 
     /**

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -21,6 +21,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.afp.fonts.AFPPageFonts;
 import org.apache.fop.util.AbstractPaintingState;
 
 /**
@@ -42,7 +43,7 @@
     private boolean colorImages = false;
 
     /** images are supported in this AFP environment */
-    private boolean nativeImages = false;
+    private boolean nativeImagesSupported = false;
 
     /** default value for image depth */
     private int bitsPerPixel = 8;
@@ -165,10 +166,10 @@
     /**
      * Sets whether images are natively supported or not in the AFP environment
      *
-     * @param nativeImages true if images are natively supported in this AFP environment
+     * @param nativeImagesSupported true if images are natively supported in this AFP environment
      */
-    public void setNativeImages(boolean nativeImages) {
-        this.nativeImages = nativeImages;
+    public void setNativeImagesSupported(boolean nativeImagesSupported) {
+        this.nativeImagesSupported = nativeImagesSupported;
     }
 
     /**
@@ -176,8 +177,8 @@
      *
      * @return true if images are supported natively in this AFP environment
      */
-    public boolean isNativeImages() {
-        return this.nativeImages;
+    public boolean isNativeImagesSupported() {
+        return this.nativeImagesSupported;
     }
 
     /**

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -23,8 +23,6 @@
 import java.io.OutputStream;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.fop.afp.modca.AbstractDataObject;
 import org.apache.fop.afp.modca.AbstractNamedAFPObject;
 import org.apache.fop.afp.modca.DataStream;
@@ -36,9 +34,6 @@
  * Manages the creation and storage of document resources
  */
 public class AFPResourceManager {
-    /** Static logging instance */
-    private static final Log log = LogFactory.getLog(AFPResourceManager.class);
-
     /** The AFP datastream (document tree) */
     private DataStream dataStream;
 

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -44,7 +44,7 @@
 
     private static final String AFPDATASTREAM_TEMP_FILE_PREFIX = "AFPDataStream_";
 
-    private static final int BUFFER_SIZE = 4096;
+    private static final int BUFFER_SIZE = 4096; // 4k writing buffer
 
     private static final String DEFAULT_EXTERNAL_RESOURCE_FILENAME = "resources.afp";
 
@@ -159,8 +159,8 @@
      *
      * @throws IOException if an an I/O exception of some sort has occurred
      */
-    public void close() throws IOException {
         // write out any external resource groups
+    public void close() throws IOException {
         Iterator it = pathResourceGroupMap.entrySet().iterator();
         while (it.hasNext()) {
             StreamedResourceGroup resourceGroup = (StreamedResourceGroup)it.next();
@@ -192,6 +192,7 @@
 
     /** {@inheritDoc} */
     public void writeToStream(OutputStream os) throws IOException {
+//        long start = System.currentTimeMillis();
         int len = (int)documentFile.length();
         int numChunks = len / BUFFER_SIZE;
         int remainingChunkSize = len % BUFFER_SIZE;
@@ -212,5 +213,7 @@
             os.write(buffer, 0, remainingChunkSize);
         }
         os.flush();
+//        long end = System.currentTimeMillis();
+//        log.debug("writing time " + (end - start) + "ms");
     }
 }
\ No newline at end of file

Modified: 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=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/Graphics2DImagePainterGOCA.java Thu Nov 13 08:11:58 2008
@@ -51,7 +51,7 @@
             /** {@inheritdoc} */
             public void prepare(Graphics2D g2d, Rectangle2D area) {
                 double tx = area.getX();
-                double ty = area.getHeight() - area.getY();
+                double ty = area.getHeight() + area.getY();
                 if (tx != 0 || ty != 0) {
                     g2d.translate(tx, ty);
                 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java Thu Nov 13 08:11:58 2008
@@ -23,32 +23,24 @@
  * This class encapsulates the font attributes that need to be included
  * in the AFP data stream. This class does not assist in converting the
  * font attributes to AFP code pages and character set values.
- *
  */
 public class AFPFontAttributes {
 
-    /**
-     * The font reference
-     */
+    /** the font reference */
     private int fontReference;
 
-    /**
-     * The font key
-     */
+    /** the font key */
     private final String fontKey;
 
-    /**
-     * The font
-     */
+    /** the font */
     private final AFPFont font;
 
-    /**
-     * The point size
-     */
+    /** the point size */
     private final int pointSize;
 
     /**
      * Constructor for the AFPFontAttributes
+     *
      * @param fontKey the font key
      * @param font the font
      * @param pointSize the point size
@@ -60,6 +52,8 @@
     }
 
     /**
+     * Return the font
+     *
      * @return the font
      */
     public AFPFont getFont() {
@@ -67,6 +61,8 @@
     }
 
     /**
+     * Return the FontKey attribute
+     *
      * @return the FontKey attribute
      */
     public String getFontKey() {
@@ -74,6 +70,8 @@
     }
 
     /**
+     * Return the point size attribute
+     *
      * @return the point size attribute
      */
     public int getPointSize() {
@@ -81,6 +79,8 @@
     }
 
     /**
+     * Return the FontReference attribute
+     *
      * @return the FontReference attribute
      */
     public int getFontReference() {
@@ -89,6 +89,7 @@
 
     /**
      * Sets the FontReference attribute
+     *
      * @param fontReference the FontReference to set
      */
     public void setFontReference(int fontReference) {

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java (from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPageFonts.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPageFonts.java&r1=708875&r2=713747&rev=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPPageFonts.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java Thu Nov 13 08:11:58 2008
@@ -17,11 +17,7 @@
 
 /* $Id$ */
 
-package org.apache.fop.afp;
-
-import org.apache.fop.afp.fonts.AFPFont;
-import org.apache.fop.afp.fonts.AFPFontAttributes;
-
+package org.apache.fop.afp.fonts;
 
 /**
  * Holds the current page fonts

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/fonts/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp.goca Package</TITLE>
+<BODY>
+<P>Contains a collection of AFP Graphics Object Content Architecture (GOCA) structured objects.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java Thu Nov 13 08:11:58 2008
@@ -73,7 +73,6 @@
      * Returns the length of this order code (typically this is the same as the coordinate length)
      *
      * @return the length of this order code
-     *
      */
     protected int getLength() {
         return this.coords.length * 2;

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsFilletRelative.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsFilletRelative.java?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsFilletRelative.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsFilletRelative.java Thu Nov 13 08:11:58 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.goca;
+
+/**
+ * A GOCA graphics curved tangential line to a specified set of
+ * straight lines drawn from the given position or current position
+ */
+public final class GraphicsFilletRelative extends AbstractGraphicsCoord {
+
+    /**
+     * Constructor
+     *
+     * @param coords the x/y coordinates for this object
+     */
+    public GraphicsFilletRelative(int[] coords) {
+        super(coords);
+    }
+
+    /** {@inheritDoc} */
+    protected byte getOrderCode() {
+        return (byte)0x85;
+    }
+
+}
\ No newline at end of file

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

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

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLine.java?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLine.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLine.java Thu Nov 13 08:11:58 2008
@@ -19,10 +19,9 @@
 
 package org.apache.fop.afp.goca;
 
-
 /**
  * A GOCA graphics straight line drawn from the
- * given position or current position.
+ * given position
  */
 public class GraphicsLine extends AbstractGraphicsCoord {
 

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLineRelative.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLineRelative.java?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLineRelative.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/GraphicsLineRelative.java Thu Nov 13 08:11:58 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.goca;
+
+/**
+ * A GOCA graphics straight line drawn from the
+ * relative from the current position.
+ */
+public class GraphicsLineRelative extends AbstractGraphicsCoord {
+
+    /**
+     * Constructor
+     *
+     * @param coords the x/y coordinates for this object
+     */
+    public GraphicsLineRelative(int[] coords) {
+        super(coords);
+    }
+
+    /** {@inheritDoc} */
+    protected byte getOrderCode() {
+        return (byte)0x81;
+    }
+
+}
\ No newline at end of file

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

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

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/goca/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp.fonts Package</TITLE>
+<BODY>
+<P>Contains a collection of AFP font related classes.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/ioca/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp.ioca Package</TITLE>
+<BODY>
+<P>Contains a collection of AFP Image Object Content Architecture (IOCA) structured objects.</P>
+</BODY>
+</HTML>
\ No newline at end of file

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -30,8 +30,10 @@
 import org.apache.fop.afp.goca.GraphicsBox;
 import org.apache.fop.afp.goca.GraphicsData;
 import org.apache.fop.afp.goca.GraphicsFillet;
+import org.apache.fop.afp.goca.GraphicsFilletRelative;
 import org.apache.fop.afp.goca.GraphicsFullArc;
 import org.apache.fop.afp.goca.GraphicsLine;
+import org.apache.fop.afp.goca.GraphicsLineRelative;
 import org.apache.fop.afp.goca.GraphicsSetArcParameters;
 import org.apache.fop.afp.goca.GraphicsSetCharacterSet;
 import org.apache.fop.afp.goca.GraphicsSetCurrentPosition;
@@ -181,7 +183,21 @@
      * @param coords the x/y coordinates (can be a series)
      */
     public void addLine(int[] coords) {
-        addObject(new GraphicsLine(coords));
+        addLine(coords, false);
+    }
+
+    /**
+     * Adds a line at the given x/y coordinates
+     *
+     * @param coords the x/y coordinates (can be a series)
+     * @param relative relative true for a line at current position (relative to)
+     */
+    public void addLine(int[] coords, boolean relative) {
+        if (relative) {
+            addObject(new GraphicsLineRelative(coords));
+        } else {
+            addObject(new GraphicsLine(coords));
+        }
     }
 
     /**
@@ -199,7 +215,21 @@
      * @param coords the x/y coordinates
      */
     public void addFillet(int[] coords) {
-        addObject(new GraphicsFillet(coords));
+        addFillet(coords, false);
+    }
+
+    /**
+     * Adds a fillet (curve) at the given coordinates
+     *
+     * @param coords the x/y coordinates
+     * @param relative relative true for a fillet at current position (relative to)
+     */
+    public void addFillet(int[] coords, boolean relative) {
+        if (relative) {
+            addObject(new GraphicsFilletRelative(coords));
+        } else {
+            addObject(new GraphicsFillet(coords));
+        }
     }
 
     /**
@@ -300,4 +330,5 @@
         copySF(data, Type.END, Category.GRAPHICS);
         os.write(data);
     }
+
 }
\ No newline at end of file

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp.modca Package</TITLE>
+<BODY>
+<P>Contains a collection of AFP Mixed Object Document Content Architecture (MO:DCA) structured objects.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp.modca.triplets Package</TITLE>
+<BODY>
+<P>Contains a collection of AFP Mixed Object Document Content Architecture (MO:DCA) triplet classes.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/package.html?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/package.html (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/package.html Thu Nov 13 08:11:58 2008
@@ -0,0 +1,23 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
+<HTML>
+<TITLE>org.apache.fop.afp Package</TITLE>
+<BODY>
+<P>Contains an AFP library.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java Thu Nov 13 08:11:58 2008
@@ -0,0 +1,105 @@
+/*
+ * 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.svg;
+
+import java.awt.geom.AffineTransform;
+
+import org.apache.batik.bridge.BridgeContext;
+import org.apache.batik.bridge.DocumentLoader;
+import org.apache.batik.bridge.UserAgent;
+import org.apache.batik.gvt.TextPainter;
+import org.apache.fop.afp.AFPGraphics2D;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.svg.AbstractFOPBridgeContext;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+
+public class AFPBridgeContext extends AbstractFOPBridgeContext {
+
+    private final AFPGraphics2D g2d;
+
+    /**
+     * Constructs a new bridge context.
+     *
+     * @param userAgent the user agent
+     * @param fontInfo the font list for the text painter, may be null
+     *                 in which case text is painted as shapes
+     * @param imageManager an image manager
+     * @param imageSessionContext an image session context
+     * @param linkTransform AffineTransform to properly place links,
+     *                      may be null
+     * @param g2d an AFPGraphics 2D implementation
+     */
+    public AFPBridgeContext(UserAgent userAgent, FontInfo fontInfo,
+            ImageManager imageManager, ImageSessionContext imageSessionContext,
+            AffineTransform linkTransform, AFPGraphics2D g2d) {
+        super(userAgent, fontInfo, imageManager, imageSessionContext, linkTransform);
+        this.g2d = g2d;
+    }
+
+    /**
+     * Constructs a new bridge context.
+     * @param userAgent the user agent
+     * @param loader the Document Loader to use for referenced documents.
+     * @param fontInfo the font list for the text painter, may be null
+     *                 in which case text is painted as shapes
+     * @param linkTransform AffineTransform to properly place links,
+     *                      may be null
+     * @param imageManager an image manager
+     * @param imageSessionContext an image session context
+     * @param linkTransform AffineTransform to properly place links,
+     *                      may be null
+     * @param an AFPGraphics 2D implementation
+     */
+    public AFPBridgeContext(UserAgent userAgent, DocumentLoader documentLoader,
+            FontInfo fontInfo, ImageManager imageManager,
+            ImageSessionContext imageSessionContext,
+            AffineTransform linkTransform, AFPGraphics2D g2d) {
+        super(userAgent, documentLoader, fontInfo, imageManager, imageSessionContext, linkTransform);
+        this.g2d = g2d;
+    }
+
+    /** {@inheritDoc} */
+    public void registerSVGBridges() {
+        super.registerSVGBridges();
+
+        if (fontInfo != null) {
+            AFPTextHandler textHandler = new AFPTextHandler(g2d);
+            g2d.setCustomTextHandler(textHandler);
+
+            TextPainter textPainter = new AFPTextPainter(textHandler);
+            setTextPainter(textPainter);
+
+            putBridge(new AFPTextElementBridge(textPainter));
+        }
+
+        putBridge(new AFPImageElementBridge());
+    }
+
+    /** {@inheritDoc} */
+    public BridgeContext createBridgeContext() {
+        return new AFPBridgeContext(getUserAgent(), getDocumentLoader(),
+                fontInfo,
+                getImageManager(),
+                getImageSessionContext(),
+                linkTransform, g2d);
+    }
+
+}

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

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

Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java?rev=713747&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java Thu Nov 13 08:11:58 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.svg;
+
+import org.apache.fop.svg.AbstractFOPImageElementBridge;
+import org.apache.xmlgraphics.image.loader.ImageFlavor;
+
+public class AFPImageElementBridge extends AbstractFOPImageElementBridge {
+
+    private final ImageFlavor[] supportedFlavors = new ImageFlavor[]
+                                                                   {ImageFlavor.RAW_JPEG,
+                                                                    ImageFlavor.RAW_CCITTFAX,
+                                                                    ImageFlavor.GRAPHICS2D,
+                                                                    ImageFlavor.XML_DOM};
+
+    /** {@inheritDoc} */
+    protected ImageFlavor[] getSupportedFlavours() {
+        return supportedFlavors;
+    }
+}

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

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

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java (from r708875, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextElementBridge.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextElementBridge.java&r1=708875&r2=713747&rev=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextElementBridge.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java Thu Nov 13 08:11:58 2008
@@ -5,9 +5,9 @@
  * 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.
@@ -17,94 +17,26 @@
 
 /* $Id$ */
 
-package org.apache.fop.afp;
+package org.apache.fop.afp.svg;
 
-import org.apache.batik.bridge.SVGTextElementBridge;
-import org.apache.batik.bridge.BridgeContext;
-import org.apache.batik.gvt.GraphicsNode;
-import org.apache.batik.gvt.TextNode;
 import org.apache.batik.gvt.TextPainter;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
+import org.apache.fop.svg.AbstractFOPTextElementBridge;
 
 /**
  * Bridge class for the &lt;text> element.
  * This bridge will use the direct text painter if the text
  * for the element is simple.
  */
-public class AFPTextElementBridge extends SVGTextElementBridge {
-    
-    private AFPTextPainter textPainter;
+public class AFPTextElementBridge extends AbstractFOPTextElementBridge {
 
     /**
      * Constructs a new bridge for the &lt;text> element.
+     *
      * @param textPainter the text painter to use
      */
-    public AFPTextElementBridge(AFPTextPainter textPainter) {
-        this.textPainter = textPainter;
-    }
-
-    /**
-     * Create a text element bridge.
-     * This set the text painter on the node if the text is simple.
-     * @param ctx the bridge context
-     * @param e the svg element
-     * @return the text graphics node created by the super class
-     */
-    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
-        GraphicsNode node = super.createGraphicsNode(ctx, e);
-        if (node != null && isSimple(ctx, e, node)) {
-            ((TextNode)node).setTextPainter(getTextPainter());
-        }
-        return node;
-    }
-
-    private TextPainter getTextPainter() {
-        return this.textPainter;
+    public AFPTextElementBridge(TextPainter textPainter) {
+        super(textPainter);
     }
 
-    /**
-     * Check if text element contains simple text.
-     * This checks the children of the text element to determine
-     * if the text is simple. The text is simple if it can be rendered
-     * with basic text drawing algorithms. This means there are no
-     * alternate characters, the font is known and there are no effects
-     * applied to the text.
-     *
-     * @param ctx the bridge context
-     * @param element the svg text element
-     * @param node the graphics node
-     * @return true if this text is simple of false if it cannot be
-     *         easily rendered using normal drawString on the PDFGraphics2D
-     */
-    private boolean isSimple(BridgeContext ctx, Element element, GraphicsNode node) {
-        for (Node n = element.getFirstChild();
-                n != null;
-                n = n.getNextSibling()) {
-
-            switch (n.getNodeType()) {
-            case Node.ELEMENT_NODE:
-
-                if (n.getLocalName().equals(SVG_TSPAN_TAG)
-                        || n.getLocalName().equals(SVG_ALT_GLYPH_TAG)) {
-                    return false;
-                } else if (n.getLocalName().equals(SVG_TEXT_PATH_TAG)) {
-                    return false;
-                } else if (n.getLocalName().equals(SVG_TREF_TAG)) {
-                    return false;
-                }
-                break;
-            case Node.TEXT_NODE:
-            case Node.CDATA_SECTION_NODE:
-            default:
-            }
-        }
-
-        /*if (CSSUtilities.convertFilter(element, node, ctx) != null) {
-            return false;
-        }*/
-
-        return true;
-    }
 }
 

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextHandler.java (from r711563, 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/svg/AFPTextHandler.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextHandler.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextHandler.java&r1=711563&r2=713747&rev=713747&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/svg/AFPTextHandler.java Thu Nov 13 08:11:58 2008
@@ -17,16 +17,18 @@
 
 /* $Id$ */
 
-package org.apache.fop.afp;
+package org.apache.fop.afp.svg;
 
 import java.awt.Color;
-import java.awt.geom.AffineTransform;
 import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.afp.AFPGraphics2D;
+import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.fonts.AFPFont;
 import org.apache.fop.afp.fonts.AFPFontAttributes;
+import org.apache.fop.afp.fonts.AFPPageFonts;
 import org.apache.fop.afp.modca.GraphicsObject;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
@@ -41,9 +43,6 @@
     /** logging instance */
     private static Log log = LogFactory.getLog(AFPTextHandler.class);
 
-    private static final int X = 0;
-    private static final int Y = 1;
-
     private AFPGraphics2D g2d = null;
 
     /** Overriding FontState */
@@ -113,7 +112,7 @@
             fontReference = registerPageFont(internalFontName, fontSize);
         } else {
             java.awt.Font awtFont = g2d.getFont();
-            AffineTransform fontTransform = awtFont.getTransform();
+//            AffineTransform fontTransform = awtFont.getTransform();
             FontInfo fontInfo = getFontInfo();
             Font fopFont = fontInfo.getFontInstanceForAWTFont(awtFont);
             String internalFontName = fopFont.getFontName();
@@ -122,14 +121,8 @@
         }
         graphicsObj.setCharacterSet(fontReference);
 
-        // calculate x, y plotting coordinates from graphics context
-        AffineTransform at = g2d.getTransform();
-        float[] srcPts = new float[] { x, y };
-        float[] dstPts = new float[srcPts.length];
-        at.transform(srcPts, 0, dstPts, 0, 1);
-
         // add the character string
-        graphicsObj.addString(str, Math.round(dstPts[X]), Math.round(dstPts[Y]));
+        graphicsObj.addString(str, Math.round(x), Math.round(y));
     }
 
     /**

Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextPainter.java (from r711563, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextPainter.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextPainter.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextPainter.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextPainter.java&r1=711563&r2=713747&rev=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPTextPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPTextPainter.java Thu Nov 13 08:11:58 2008
@@ -17,13 +17,14 @@
 
 /* $Id$ */
 
-package org.apache.fop.afp;
+package org.apache.fop.afp.svg;
 
 import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Paint;
 import java.awt.Shape;
 import java.awt.font.TextAttribute;
+import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
@@ -42,6 +43,7 @@
 import org.apache.batik.gvt.text.TextPaintInfo;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.afp.AFPGraphics2D;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
@@ -80,6 +82,7 @@
     /**
      * Paints the specified attributed character iterator using the
      * specified Graphics2D and context and font context.
+     *
      * @param node the TextNode to paint
      * @param g2d the Graphics2D to use
      */
@@ -87,10 +90,10 @@
         Point2D loc = node.getLocation();
         log.debug("painting text node " + node);
         if (hasUnsupportedAttributes(node)) {
-            log.debug("hasunsuportedattributes");
+            log.debug("hasUnsuportedAttributes");
             PROXY_PAINTER.paint(node, g2d);
         } else {
-            log.debug("allattributessupported");
+            log.debug("allAttributesSupported");
             paintTextRuns(node.getTextRuns(), g2d, loc);
         }
     }
@@ -221,7 +224,8 @@
         aci.first();
 
         updateLocationFromACI(aci, loc);
-        loc = g2d.getTransform().transform(loc, null);
+        AffineTransform at = g2d.getTransform();
+        loc = at.transform(loc, null);
 
         // font
         Font font = makeFont(aci);
@@ -240,6 +244,7 @@
         }
         g2d.setPaint(foreground);
 
+        // text
         String txt = getText(aci);
         float advance = getStringWidth(txt, font);
         float tx = 0;
@@ -258,9 +263,11 @@
         }
 
         // draw string
+        double x = loc.getX();
+        double y = loc.getY();
         try {
             try {
-                nativeTextHandler.drawString(txt, (float)(loc.getX() + tx), (float)(loc.getY()));
+                nativeTextHandler.drawString(txt, (float)x + tx, (float)y);
             } catch (IOException ioe) {
                 if (g2d instanceof AFPGraphics2D) {
                     ((AFPGraphics2D)g2d).handleIOException(ioe);
@@ -424,6 +431,7 @@
      * Get the geometry bounds.
      * This uses the StrokingTextPainter to get the bounds
      * since in theory it should be the same.
+     *
      * @param node the text node
      * @return the bounds of the text
      */
@@ -436,6 +444,7 @@
     /**
      * Get the mark.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param node the text node
      * @param pos the position
      * @param all select all
@@ -448,6 +457,7 @@
     /**
      * Select at.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param x the x position
      * @param y the y position
      * @param node the text node
@@ -460,6 +470,7 @@
     /**
      * Select to.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param x the x position
      * @param y the y position
      * @param beginMark the start mark
@@ -472,6 +483,7 @@
     /**
      * Selec first.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param node the text node
      * @return null
      */
@@ -482,6 +494,7 @@
     /**
      * Select last.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param node the text node
      * @return null
      */
@@ -492,6 +505,7 @@
     /**
      * Get selected.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param start the start mark
      * @param finish the finish mark
      * @return null
@@ -503,6 +517,7 @@
     /**
      * Get the highlighted shape.
      * This does nothing since the output is AFP and not interactive.
+     *
      * @param beginMark the start mark
      * @param endMark the end mark
      * @return null

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java Thu Nov 13 08:11:58 2008
@@ -389,8 +389,8 @@
             }
             matchedTriplet = fontLookup(awtFontFamily, awtFontStyle, awtFontWeight);
         }
-        float awtFontSize = awtFont.getSize2D();
-        return getFontInstance(matchedTriplet, (int)(awtFontSize * 1000 + 0.5));
+        int fontSize = Math.round(awtFont.getSize2D() * 1000);
+        return getFontInstance(matchedTriplet, fontSize);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/package.html?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/package.html (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/package.html Thu Nov 13 08:11:58 2008
@@ -1,3 +1,20 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
 <HTML>
 <TITLE>org.apache.fop.fonts Package</TITLE>
 <BODY>

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/package.html?rev=713747&r1=713746&r2=713747&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/package.html (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/pdf/package.html Thu Nov 13 08:11:58 2008
@@ -1,3 +1,20 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
 <HTML>
 <TITLE>org.apache.fop.pdf Package</TITLE>
 <BODY>

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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -29,10 +29,12 @@
 import org.apache.batik.dom.AbstractDocument;
 import org.apache.batik.dom.svg.SVGDOMImplementation;
 import org.apache.batik.gvt.GraphicsNode;
+import org.apache.fop.apps.FOUserAgent;
 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.render.afp.AFPGraphics2DAdapter;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
@@ -71,7 +73,7 @@
      * @param imageSize the image size
      * @return a new graphics 2D image painter implementation
      */
-    protected Graphics2DImagePainter createPainter(
+    protected Graphics2DImagePainter createGraphics2DImagePainter(
             GraphicsNode root, BridgeContext ctx, Dimension imageSize) {
         return new Graphics2DImagePainterImpl(root, ctx, imageSize);
     }
@@ -85,14 +87,14 @@
      * @return a built GVT root tree
      */
     protected GraphicsNode buildGraphicsNode(
-            RendererContext rendererContext, BridgeContext ctx, Document doc) {
+            FOUserAgent userAgent, BridgeContext ctx, Document doc) {
         GVTBuilder builder = new GVTBuilder();
         final GraphicsNode root;
         try {
             root = builder.build(ctx, doc);
         } catch (Exception e) {
             EventBroadcaster eventBroadcaster
-                = rendererContext.getUserAgent().getEventBroadcaster();
+                = userAgent.getEventBroadcaster();
             SVGEventProducer eventProducer = SVGEventProducer.Provider.get(eventBroadcaster);
             final String uri = getDocumentURI(doc);
             eventProducer.svgNotBuilt(this, e, uri);
@@ -102,6 +104,18 @@
     }
 
     /**
+     * Returns the image size
+     * @param wrappedContext renderer context wrapper
+     *
+     * @return the image size
+     */
+    protected Dimension getImageSize(RendererContextWrapper wrappedContext) {
+        final int width = wrappedContext.getWidth();
+        final int height = wrappedContext.getHeight();
+        return new Dimension(width, height);
+    }
+
+    /**
      * Render the SVG document.
      *
      * @param rendererContext the renderer context
@@ -113,23 +127,21 @@
         updateRendererContext(rendererContext);
 
         //Prepare
-        SVGUserAgent svgUserAgent = new SVGUserAgent(
-                rendererContext.getUserAgent(), new AffineTransform());
+        FOUserAgent userAgent = rendererContext.getUserAgent();
+        SVGUserAgent svgUserAgent = new SVGUserAgent(userAgent, new AffineTransform());
+
+        //Create Batik BridgeContext
         final BridgeContext bridgeContext = new BridgeContext(svgUserAgent);
 
         //Build the GVT tree
-        final GraphicsNode root = buildGraphicsNode(rendererContext, bridgeContext, doc);
 
+        final GraphicsNode root = buildGraphicsNode(userAgent, bridgeContext, doc);
+
+        // Create Graphics2DImagePainter
         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);
+        Dimension imageSize = getImageSize(wrappedContext);
+        final Graphics2DImagePainter painter = createGraphics2DImagePainter(root, bridgeContext, imageSize);
 
         //Let the painter paint the SVG on the Graphics2D instance
         Graphics2DAdapter g2dAdapter = rendererContext.getRenderer().getGraphics2DAdapter();
@@ -137,6 +149,8 @@
         //Paint the image
         final int x = wrappedContext.getCurrentXPosition();
         final int y = wrappedContext.getCurrentYPosition();
+        final int width = wrappedContext.getWidth();
+        final int height = wrappedContext.getHeight();
         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=713747&r1=713746&r2=713747&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 Thu Nov 13 08:11:58 2008
@@ -54,8 +54,8 @@
     protected BufferedImage paintToBufferedImage(
             org.apache.xmlgraphics.java2d.Graphics2DImagePainter painter,
              RendererContextWrapper context, int resolution, boolean gray, boolean withAlpha) {
-        int bmw = (int)Math.ceil(UnitConv.mpt2px(context.getWidth(), resolution));
-        int bmh = (int)Math.ceil(UnitConv.mpt2px(context.getHeight(), resolution));
+        int bmw = mpt2px(context.getWidth(), resolution);
+        int bmh = mpt2px(context.getHeight(), resolution);
         BufferedImage bi;
         if (gray) {
             if (withAlpha) {
@@ -102,6 +102,17 @@
         return bi;
     }
 
+    /**
+     * Converts millipoints to pixels
+     *
+     * @param unit the unit to convert in mpts
+     * @param resolution the target resolution
+     * @return the converted unit in pixels
+     */
+    protected int mpt2px(int unit, int resolution) {
+        return (int)Math.ceil(UnitConv.mpt2px(unit, resolution));
+    }
+
     private static BufferedImage createGrayBufferedImageWithAlpha(int width, int height) {
         BufferedImage bi;
         boolean alphaPremultiplied = true;



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


Re: [!! SPAM] Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Chris Bowditch <bo...@hotmail.com>.
Adrian Cumiskey wrote:

> Jeremias,

Adrian,

> 
> Jeremias Maerki wrote:
> 
>>> I'm sure if such a person existed and they wrote their own FOP 
>>> plug-in they could very easily fix a very small compatibility issue 
>>> such as this.
>>
>>
>> Again: it's not the fix that is the problem. It is about
>> backwards-compatibility and that's an issue mostly for users and release
>> managers. Developers have an easy life. Imagine what would happen if
>> Linus Torvalds would constantly change the API for low-level drivers or
>> if Sun would simply change APIs in their Java class library without
>> respecting backwards compatibility.
> 
> 
> I didn't make a change to a low-level driver used by millions.  I made a 
> change to one method signature of one interface that affected one 
> external package used by FOP that you host externally on your own 
> website.  I'm sorry that this change meant a small amount of 
> work/support overhead for you, but you are losing perspective here.

The point here isn't the affect of the change but the way you went about 
it, i.e. you just committed it and didn't tell anyway one about it, we 
had to find out for ourselves.

> 
>>>>> I have included the simple 2 line patch file for 
>>>>> src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  
>>>>> Apologies if this creates a little more work for you.
>>>>
>>>> Your patch has one problem: it kills backwards-compatibility for FOP
>>>> 0.95. I won't delete the old method so this whole thing will still work
>>>> with 0.95.
>>>
>>> I don't see how this would at all affect 0.95 compatibility.  You 
>>> already provide a cersion 1.2
>>> (http://www.jeremias-maerki.ch/download/fop/pdf-images) which will 
>>> work just fine for 0.95
>>> installations - so no change there.  And you also already provide a 
>>> version 1.1a (from rev 611768 or later), so all that needs to be done 
>>> once the Temp_AFPGOCAResources branch is merged back into trunk is 
>>> release a new trunk version with the 2 line patch applied.
>>
>>
>> Yeah, and after your logic I'll continue to play that game indefinitely.
>> Each time we release a new FOP, I have to update my plug-in. That's not
>> my idea of software development.
> 
> 
> You know full well that this situation is not to be expected, this was 
> just an exception.  My idea of software development doesn't involve 
> spending lots of time trying to score points off each other on a mailing 
> list over quite small issues.

I don't think anyone is trying to score points here. We are just trying 
to find out the underlying reasons for the change to the interface. So 
far you've not given us a good technical reason. The reason you did give 
  about the Image handler in the AFP Renderer needing to support 
multiple image types has been proven to be unnecessary (see Jeremias' 
reply to the Merge branch thread)

> 
>>>> The necessary changes in my plug-in are negligible. What isn't is the
>>>> time I'll spend documenting which version of the plug-in the users have
>>>> to select for which FOP version. Add to that time I spend on answering
>>>> the questions of the people who don't RTFM.
>>>
>>> I sympathize, users can be demanding even when you give of your time 
>>> freely :).
>>>
>>>> I wonder if you've spent one second thinking about
>>>> backwards-compatibility before changing the PDFImageHandler interface.
>>>
>>> Quite simply I wasn't aware that your external pdf images package 
>>> touched upon this interface.  Its not part of the FOP code base.  I 
>>> will continue to always want what is best for the health of the 
>>> project, I find your comment both unnecessarily rude and disrespectful.
>>
>>
>> It doesn't really matter if I have an external implementation of that
>> interface or not. The interface was designed as a service provider
>> interface with dynamic registration. That automatically turns it into an
>> external interface for FOP which needs to be treated with care.
>>
>> The PDF renderer doesn't profit from the changes you made. It just
>> breaks the already existing plug-ins. You've had an idea for the image
>> handler plug-ins for the AFP Renderer and you wanted to reuse the
>> registry part. And that's what affects the PDF part. The name clash in
>> the IF branch is another story. That one is not even so important.
> 
> 
> I never claimed that the PDF renderer would profit did I?  But other 
> parts of FOP certainly could.
> 
>> Change happens, yes, improvements happen, too, but the "after me the
>> Flood" mentality makes my blood boil.
> 
> 
> I have no such mentality, you boil your own blood.  I fail to understand
> why you continue to blow up small points out of all proportion and 
> attack me in this way.  I have worked very hard to improve our AFP 
> support and now you try to provoke me and make things ugly.

Let's try to stay calm. No one is attacking anyone. We are simply some 
intellectual's trying to understand each other's point of view. 
Sometimes e-mail is not the best way to do this as it is a very cold 
form of communication. I don't mean any offence by my questions and I'm 
certain Jeremias' means none by his.

Regards,

Chris

> 
> Adrian.
> 
> 




Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Adrian Cumiskey <de...@cumiskey.com>.
Jeremias,

Jeremias Maerki wrote:
>> I'm sure if such a person existed and they wrote their own FOP plug-in they could very easily fix a 
>> very small compatibility issue such as this.
> 
> Again: it's not the fix that is the problem. It is about
> backwards-compatibility and that's an issue mostly for users and release
> managers. Developers have an easy life. Imagine what would happen if
> Linus Torvalds would constantly change the API for low-level drivers or
> if Sun would simply change APIs in their Java class library without
> respecting backwards compatibility.

I didn't make a change to a low-level driver used by millions.  I made a change to one method 
signature of one interface that affected one external package used by FOP that you host externally 
on your own website.  I'm sorry that this change meant a small amount of work/support overhead for 
you, but you are losing perspective here.

>>>> I have included the simple 2 line patch file for 
>>>> src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  Apologies if this creates a 
>>>> little more work for you.
>>> Your patch has one problem: it kills backwards-compatibility for FOP
>>> 0.95. I won't delete the old method so this whole thing will still work
>>> with 0.95.
>> I don't see how this would at all affect 0.95 compatibility.  You already provide a cersion 1.2
>> (http://www.jeremias-maerki.ch/download/fop/pdf-images) which will work just fine for 0.95
>> installations - so no change there.  And you also already provide a version 1.1a (from rev 611768 or 
>> later), so all that needs to be done once the Temp_AFPGOCAResources branch is merged back into trunk 
>> is release a new trunk version with the 2 line patch applied.
> 
> Yeah, and after your logic I'll continue to play that game indefinitely.
> Each time we release a new FOP, I have to update my plug-in. That's not
> my idea of software development.

You know full well that this situation is not to be expected, this was just an exception.  My idea 
of software development doesn't involve spending lots of time trying to score points off each other 
on a mailing list over quite small issues.

>>> The necessary changes in my plug-in are negligible. What isn't is the
>>> time I'll spend documenting which version of the plug-in the users have
>>> to select for which FOP version. Add to that time I spend on answering
>>> the questions of the people who don't RTFM.
>> I sympathize, users can be demanding even when you give of your time freely :).
>>
>>> I wonder if you've spent one second thinking about
>>> backwards-compatibility before changing the PDFImageHandler interface.
>> Quite simply I wasn't aware that your external pdf images package touched upon this interface.  Its 
>> not part of the FOP code base.  I will continue to always want what is best for the health of the 
>> project, I find your comment both unnecessarily rude and disrespectful.
> 
> It doesn't really matter if I have an external implementation of that
> interface or not. The interface was designed as a service provider
> interface with dynamic registration. That automatically turns it into an
> external interface for FOP which needs to be treated with care.
> 
> The PDF renderer doesn't profit from the changes you made. It just
> breaks the already existing plug-ins. You've had an idea for the image
> handler plug-ins for the AFP Renderer and you wanted to reuse the
> registry part. And that's what affects the PDF part. The name clash in
> the IF branch is another story. That one is not even so important.

I never claimed that the PDF renderer would profit did I?  But other parts of FOP certainly could.

> Change happens, yes, improvements happen, too, but the "after me the
> Flood" mentality makes my blood boil.

I have no such mentality, you boil your own blood.  I fail to understand
why you continue to blow up small points out of all proportion and attack me in this way.  I have 
worked very hard to improve our AFP support and now you try to provoke me and make things ugly.

Adrian.

Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 24.11.2008 15:50:40 Adrian Cumiskey wrote:
> Jeremias Maerki wrote:
> > On 24.11.2008 13:14:35 Adrian Cumiskey wrote:
> >> Jeremias,
> >>
> >> Jeremias Maerki wrote:
> >>> Adrian,
> >>>
> >>> I'm unhappy with this change. I know you're constantly trying to
> >>> improve things by refactoring but you also need to be careful about
> >>> preserving compatibility. In this case, you broke my external PDF-in-PDF
> >>> plug-in by changing the interface from "Class getSupportedImageClass()"
> >>> to "Class[] getSupportedImageClasses()". Furthermore, chosing
> >>> "ImageHandler" as the interface name will result in a name clash when
> >>> the AFP branch is merged back into Trunk and I'll try to merge those
> >>> changes into the IF branch. After all, in this branch the whole image
> >>> handling is already properly abstracted for all renderers, not just PDF
> >>> and AFP. So I think we need to revisit that before we consider a merge
> >>> of the AFP GOCA branch into Trunk.
> >>>
> >>> I think, we have the following options:
> >>> 1. Remove ImageHandler in the GOCA branch, restore plug-in compatibility
> >>> for PDFImageHandler and have a separate service registry class for AFP
> >>> and PDF. (My preffered option)
> >> I think this option would involve the most amount of work and regression testing.  Furthermore, this 
> >> is work that will probably be thrown away later.  It does not need to be done now and can be 
> >> revisited later when the Temp_AreaTreeNewDesign branch is ready to be merged back into trunk.
> >>
> >>> 2. We can selectively merge parts of the IF branch (the ImageHandler
> >>> abstraction) into trunk before merging the rest (I could do that for you,
> >>> if nobody objects the partial merge-back). From there you could make use
> >>> of it in the GOCA branch and restore the PDFImageHandler. You could then
> >>> use the same image handlers for the current code as well as the
> >>> implementation for the new IF.
> >> This sounds a bit messy, its better we do the merge in one go, a halfway situation is never a good 
> >> one and I would expect quite a bit of management overhead created by this.
> >>
> >>> 3. I have to adjust my PDF plug-in and do another release knowing that
> >>> this is only for restoring compatibility.
> >> I would favour this option.  This represents the least amount of change to FOP and the least amount 
> >> of work/regression testing etc.  This is a very small change that should only effect a small number 
> >> of users who upgrade their FOP installation to trunk and forget to upgrade their pdf images plugin.
> > 
> > Cheap excuse to ignore backwards-compatibility. What if there were other
> > people who wrote plug-ins of their own?
> 
> I'm sure if such a person existed and they wrote their own FOP plug-in they could very easily fix a 
> very small compatibility issue such as this.

Again: it's not the fix that is the problem. It is about
backwards-compatibility and that's an issue mostly for users and release
managers. Developers have an easy life. Imagine what would happen if
Linus Torvalds would constantly change the API for low-level drivers or
if Sun would simply change APIs in their Java class library without
respecting backwards compatibility.

> >> I have included the simple 2 line patch file for 
> >> src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  Apologies if this creates a 
> >> little more work for you.
> > 
> > Your patch has one problem: it kills backwards-compatibility for FOP
> > 0.95. I won't delete the old method so this whole thing will still work
> > with 0.95.
> 
> I don't see how this would at all affect 0.95 compatibility.  You already provide a cersion 1.2
> (http://www.jeremias-maerki.ch/download/fop/pdf-images) which will work just fine for 0.95
> installations - so no change there.  And you also already provide a version 1.1a (from rev 611768 or 
> later), so all that needs to be done once the Temp_AFPGOCAResources branch is merged back into trunk 
> is release a new trunk version with the 2 line patch applied.

Yeah, and after your logic I'll continue to play that game indefinitely.
Each time we release a new FOP, I have to update my plug-in. That's not
my idea of software development.

> > The necessary changes in my plug-in are negligible. What isn't is the
> > time I'll spend documenting which version of the plug-in the users have
> > to select for which FOP version. Add to that time I spend on answering
> > the questions of the people who don't RTFM.
> 
> I sympathize, users can be demanding even when you give of your time freely :).
>
> > I wonder if you've spent one second thinking about
> > backwards-compatibility before changing the PDFImageHandler interface.
> 
> Quite simply I wasn't aware that your external pdf images package touched upon this interface.  Its 
> not part of the FOP code base.  I will continue to always want what is best for the health of the 
> project, I find your comment both unnecessarily rude and disrespectful.

It doesn't really matter if I have an external implementation of that
interface or not. The interface was designed as a service provider
interface with dynamic registration. That automatically turns it into an
external interface for FOP which needs to be treated with care.

The PDF renderer doesn't profit from the changes you made. It just
breaks the already existing plug-ins. You've had an idea for the image
handler plug-ins for the AFP Renderer and you wanted to reuse the
registry part. And that's what affects the PDF part. The name clash in
the IF branch is another story. That one is not even so important.

Change happens, yes, improvements happen, too, but the "after me the
Flood" mentality makes my blood boil.


Jeremias Maerki


Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Adrian Cumiskey <de...@cumiskey.com>.
Jeremias Maerki wrote:
> On 24.11.2008 13:14:35 Adrian Cumiskey wrote:
>> Jeremias,
>>
>> Jeremias Maerki wrote:
>>> Adrian,
>>>
>>> I'm unhappy with this change. I know you're constantly trying to
>>> improve things by refactoring but you also need to be careful about
>>> preserving compatibility. In this case, you broke my external PDF-in-PDF
>>> plug-in by changing the interface from "Class getSupportedImageClass()"
>>> to "Class[] getSupportedImageClasses()". Furthermore, chosing
>>> "ImageHandler" as the interface name will result in a name clash when
>>> the AFP branch is merged back into Trunk and I'll try to merge those
>>> changes into the IF branch. After all, in this branch the whole image
>>> handling is already properly abstracted for all renderers, not just PDF
>>> and AFP. So I think we need to revisit that before we consider a merge
>>> of the AFP GOCA branch into Trunk.
>>>
>>> I think, we have the following options:
>>> 1. Remove ImageHandler in the GOCA branch, restore plug-in compatibility
>>> for PDFImageHandler and have a separate service registry class for AFP
>>> and PDF. (My preffered option)
>> I think this option would involve the most amount of work and regression testing.  Furthermore, this 
>> is work that will probably be thrown away later.  It does not need to be done now and can be 
>> revisited later when the Temp_AreaTreeNewDesign branch is ready to be merged back into trunk.
>>
>>> 2. We can selectively merge parts of the IF branch (the ImageHandler
>>> abstraction) into trunk before merging the rest (I could do that for you,
>>> if nobody objects the partial merge-back). From there you could make use
>>> of it in the GOCA branch and restore the PDFImageHandler. You could then
>>> use the same image handlers for the current code as well as the
>>> implementation for the new IF.
>> This sounds a bit messy, its better we do the merge in one go, a halfway situation is never a good 
>> one and I would expect quite a bit of management overhead created by this.
>>
>>> 3. I have to adjust my PDF plug-in and do another release knowing that
>>> this is only for restoring compatibility.
>> I would favour this option.  This represents the least amount of change to FOP and the least amount 
>> of work/regression testing etc.  This is a very small change that should only effect a small number 
>> of users who upgrade their FOP installation to trunk and forget to upgrade their pdf images plugin.
> 
> Cheap excuse to ignore backwards-compatibility. What if there were other
> people who wrote plug-ins of their own?

I'm sure if such a person existed and they wrote their own FOP plug-in they could very easily fix a 
very small compatibility issue such as this.

>> I have included the simple 2 line patch file for 
>> src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  Apologies if this creates a 
>> little more work for you.
> 
> Your patch has one problem: it kills backwards-compatibility for FOP
> 0.95. I won't delete the old method so this whole thing will still work
> with 0.95.

I don't see how this would at all affect 0.95 compatibility.  You already provide a cersion 1.2
(http://www.jeremias-maerki.ch/download/fop/pdf-images) which will work just fine for 0.95
installations - so no change there.  And you also already provide a version 1.1a (from rev 611768 or 
later), so all that needs to be done once the Temp_AFPGOCAResources branch is merged back into trunk 
is release a new trunk version with the 2 line patch applied.

> The necessary changes in my plug-in are negligible. What isn't is the
> time I'll spend documenting which version of the plug-in the users have
> to select for which FOP version. Add to that time I spend on answering
> the questions of the people who don't RTFM.

I sympathize, users can be demanding even when you give of your time freely :).

> I wonder if you've spent one second thinking about
> backwards-compatibility before changing the PDFImageHandler interface.

Quite simply I wasn't aware that your external pdf images package touched upon this interface.  Its 
not part of the FOP code base.  I will continue to always want what is best for the health of the 
project, I find your comment both unnecessarily rude and disrespectful.

Adrian.

Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 24.11.2008 13:14:35 Adrian Cumiskey wrote:
> Jeremias,
> 
> Jeremias Maerki wrote:
> > Adrian,
> > 
> > I'm unhappy with this change. I know you're constantly trying to
> > improve things by refactoring but you also need to be careful about
> > preserving compatibility. In this case, you broke my external PDF-in-PDF
> > plug-in by changing the interface from "Class getSupportedImageClass()"
> > to "Class[] getSupportedImageClasses()". Furthermore, chosing
> > "ImageHandler" as the interface name will result in a name clash when
> > the AFP branch is merged back into Trunk and I'll try to merge those
> > changes into the IF branch. After all, in this branch the whole image
> > handling is already properly abstracted for all renderers, not just PDF
> > and AFP. So I think we need to revisit that before we consider a merge
> > of the AFP GOCA branch into Trunk.
> > 
> > I think, we have the following options:
> > 1. Remove ImageHandler in the GOCA branch, restore plug-in compatibility
> > for PDFImageHandler and have a separate service registry class for AFP
> > and PDF. (My preffered option)
> 
> I think this option would involve the most amount of work and regression testing.  Furthermore, this 
> is work that will probably be thrown away later.  It does not need to be done now and can be 
> revisited later when the Temp_AreaTreeNewDesign branch is ready to be merged back into trunk.
> 
> > 2. We can selectively merge parts of the IF branch (the ImageHandler
> > abstraction) into trunk before merging the rest (I could do that for you,
> > if nobody objects the partial merge-back). From there you could make use
> > of it in the GOCA branch and restore the PDFImageHandler. You could then
> > use the same image handlers for the current code as well as the
> > implementation for the new IF.
> 
> This sounds a bit messy, its better we do the merge in one go, a halfway situation is never a good 
> one and I would expect quite a bit of management overhead created by this.
> 
> > 3. I have to adjust my PDF plug-in and do another release knowing that
> > this is only for restoring compatibility.
> 
> I would favour this option.  This represents the least amount of change to FOP and the least amount 
> of work/regression testing etc.  This is a very small change that should only effect a small number 
> of users who upgrade their FOP installation to trunk and forget to upgrade their pdf images plugin.

Cheap excuse to ignore backwards-compatibility. What if there were other
people who wrote plug-ins of their own?

> I have included the simple 2 line patch file for 
> src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  Apologies if this creates a 
> little more work for you.

Your patch has one problem: it kills backwards-compatibility for FOP
0.95. I won't delete the old method so this whole thing will still work
with 0.95.

The necessary changes in my plug-in are negligible. What isn't is the
time I'll spend documenting which version of the plug-in the users have
to select for which FOP version. Add to that time I spend on answering
the questions of the people who don't RTFM.

I wonder if you've spent one second thinking about
backwards-compatibility before changing the PDFImageHandler interface.

So I guess it's up to me anyway to fix this problem.


Jeremias Maerki


Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Adrian Cumiskey <de...@cumiskey.com>.
Jeremias,

Jeremias Maerki wrote:
> Adrian,
> 
> I'm unhappy with this change. I know you're constantly trying to
> improve things by refactoring but you also need to be careful about
> preserving compatibility. In this case, you broke my external PDF-in-PDF
> plug-in by changing the interface from "Class getSupportedImageClass()"
> to "Class[] getSupportedImageClasses()". Furthermore, chosing
> "ImageHandler" as the interface name will result in a name clash when
> the AFP branch is merged back into Trunk and I'll try to merge those
> changes into the IF branch. After all, in this branch the whole image
> handling is already properly abstracted for all renderers, not just PDF
> and AFP. So I think we need to revisit that before we consider a merge
> of the AFP GOCA branch into Trunk.
> 
> I think, we have the following options:
> 1. Remove ImageHandler in the GOCA branch, restore plug-in compatibility
> for PDFImageHandler and have a separate service registry class for AFP
> and PDF. (My preffered option)

I think this option would involve the most amount of work and regression testing.  Furthermore, this 
is work that will probably be thrown away later.  It does not need to be done now and can be 
revisited later when the Temp_AreaTreeNewDesign branch is ready to be merged back into trunk.

> 2. We can selectively merge parts of the IF branch (the ImageHandler
> abstraction) into trunk before merging the rest (I could do that for you,
> if nobody objects the partial merge-back). From there you could make use
> of it in the GOCA branch and restore the PDFImageHandler. You could then
> use the same image handlers for the current code as well as the
> implementation for the new IF.

This sounds a bit messy, its better we do the merge in one go, a halfway situation is never a good 
one and I would expect quite a bit of management overhead created by this.

> 3. I have to adjust my PDF plug-in and do another release knowing that
> this is only for restoring compatibility.

I would favour this option.  This represents the least amount of change to FOP and the least amount 
of work/regression testing etc.  This is a very small change that should only effect a small number 
of users who upgrade their FOP installation to trunk and forget to upgrade their pdf images plugin.

I have included the simple 2 line patch file for 
src/java/org/apache/fop/render/pdf/pdfbox/PDFBoxPDFImageHandler.java.  Apologies if this creates a 
little more work for you.

Adrian.

Re: svn commit: r713747 [1/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src: documentation/content/xdocs/trunk/ java/META-INF/services/ java/org/apache/fop/afp/ java/org/apache/fop/afp/fonts/ java/org/apache/fop/afp/goca/ java/org/apache/fop/afp...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Adrian,

I'm unhappy with this change. I know you're constantly trying to
improve things by refactoring but you also need to be careful about
preserving compatibility. In this case, you broke my external PDF-in-PDF
plug-in by changing the interface from "Class getSupportedImageClass()"
to "Class[] getSupportedImageClasses()". Furthermore, chosing
"ImageHandler" as the interface name will result in a name clash when
the AFP branch is merged back into Trunk and I'll try to merge those
changes into the IF branch. After all, in this branch the whole image
handling is already properly abstracted for all renderers, not just PDF
and AFP. So I think we need to revisit that before we consider a merge
of the AFP GOCA branch into Trunk.

I think, we have the following options:
1. Remove ImageHandler in the GOCA branch, restore plug-in compatibility
for PDFImageHandler and have a separate service registry class for AFP
and PDF. (My preffered option)
2. We can selectively merge parts of the IF branch (the ImageHandler
abstraction) into trunk before merging the rest (I could do that for you,
if nobody objects the partial merge-back). From there you could make use
of it in the GOCA branch and restore the PDFImageHandler. You could then
use the same image handlers for the current code as well as the
implementation for the new IF.
3. I have to adjust my PDF plug-in and do another release knowing that
this is only for restoring compatibility.

On 13.11.2008 17:12:00 acumiskey wrote:
> Author: acumiskey
> Date: Thu Nov 13 08:11:58 2008
> New Revision: 713747
> 
> URL: http://svn.apache.org/viewvc?rev=713747&view=rev
> Log:
> * PDFImageHandler interface split into ImageHandler and PDFImageHandler.
> * Deleted AFPDataObjectInfoProvider and AFPImage*Factory implementations, and abstracted AbstractImageHandlerRegistry from PDFImageHandlerRegistry, creating AFPImageHandlerRegistry and AFPImageHandler so there is a common reuse of image handling implementation between AFP and PDF now.
> * RendererContext instantiation is now overridable in PrintRenderer.
> * Created AFPRendererContext that is able to provide AFPInfo.
> * toString() added to RendererContext for ease of use.
> * Removed GraphicsObjectPainterAFP.
> * Added package.html for AFP (sub)packages.
> * Abstracted AbstractFOPBridgeContext from PDFBridgeContext and provided AFPBridgeContext implementation.
> * Abstracted AbstractFOPTextElementBridge from PDFTextElementBridge and provided AFPTextElementBridge implementation.
> * Abstracted AbstractFOPImageElementBridge from PDFImageElementBridge and provided AFPImageElementBridge implementation.
> * Provided inline image support/handling in AFPGraphics2D for SVG.
> * Created NativeImageHandler interface.
> * Fix for path iterator filled line drawing in AFPGraphics2D adding coordinate drawing implementations GraphicsLineRelative and GraphicsFilletRelative (Thanks for the patch Jeremias).
> * Improved configuration.xml documentation for images mode/native setting in AFP renderer configuration.
<snip/>



Jeremias Maerki