xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r706553 - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign: ./ examples/plan/src/org/apache/fop/plan/ src/java/META-INF/services/ src/java/org/apache/fop/cli/ src/java/org/apache/fop/image/loader/batik/ src/java/org/apache/fop/layoutmgr/...
Date Tue, 21 Oct 2008 08:58:10 GMT
Author: jeremias
Date: Tue Oct 21 01:58:08 2008
New Revision: 706553

URL: http://svn.apache.org/viewvc?rev=706553&view=rev
Log:
Merge from Trunk revisions 699793 to 706550.

Modified:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/build.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/CommandLineOptions.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/Main.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFContentHandler.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLRenderer.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSRenderer.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java
  (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java
  (props changed)

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1,2 +1,2 @@
 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:603620-699792
+/xmlgraphics/fop/trunk:603620-706550

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/build.xml?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/build.xml Tue Oct 21 01:58:08 2008
@@ -459,6 +459,9 @@
       </manifest>
     </jar>
   </target>
+  <!-- =================================================================== -->
+  <!-- Retroweaver                                                         -->
+  <!-- =================================================================== -->
   <target name="retro-unavail" unless="java14.rt.lib">
     <echo message="Please set the path to a JDK 1.4 installation in your build-local.properties"
/>
     <echo message="to allow for verification!" />

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java
Tue Oct 21 01:58:08 2008
@@ -30,6 +30,7 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -76,15 +77,15 @@
             DOMResult res = new DOMResult();
             transformer.transform(source, res);
 
+            //Have to render the plan to know its size
+            PlanRenderer pr = new PlanRenderer();
             Document planDoc = (Document)res.getNode();
-            if (!PlanElementMapping.NAMESPACE.equals(
-                    planDoc.getDocumentElement().getNamespaceURI())) {
+            Element rootEl = planDoc.getDocumentElement();
+            if (!PlanElementMapping.NAMESPACE.equals(rootEl.getNamespaceURI())) {
                 in.reset();
                 return null;
             }
 
-            //Have to render the plan to know its size
-            PlanRenderer pr = new PlanRenderer();
             Document svgDoc = pr.createSVGDocument(planDoc);
             float width = pr.getWidth();
             float height = pr.getHeight();

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-706550

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/CommandLineOptions.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/CommandLineOptions.java
Tue Oct 21 01:58:08 2008
@@ -23,17 +23,15 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.PrintStream;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Vector;
 
 import javax.swing.UIManager;
 
-import org.xml.sax.SAXException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.Version;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
@@ -51,6 +49,7 @@
 import org.apache.fop.render.print.PrintRenderer;
 import org.apache.fop.render.xml.XMLRenderer;
 import org.apache.fop.util.CommandLineLogger;
+import org.xml.sax.SAXException;
 
 /**
  * Options parses the commandline arguments
@@ -135,7 +134,8 @@
     }
 
     /**
-     * Parse the command line arguments.
+     * Parses the command line arguments.
+     *
      * @param args the command line arguments.
      * @throws FOPException for general errors
      * @throws IOException if the the configuration file could not be loaded
@@ -166,10 +166,10 @@
                 return false;
             }
         } catch (FOPException e) {
-            printUsage();
+            printUsage(System.err);
             throw e;
         } catch (java.io.FileNotFoundException e) {
-            printUsage();
+            printUsage(System.err);
             throw e;
         }
 
@@ -236,12 +236,18 @@
     }
 
     /**
-     * parses the commandline arguments
-     * @return true if parse was successful and processing can continue, false
-     * if processing should stop
+     * Parses the command line arguments.
+     *
+     * @return true if processing can continue, false if it should stop (nothing to do)
      * @exception FOPException if there was an error in the format of the options
      */
     private boolean parseOptions(String[] args) throws FOPException {
+        // do not throw an exception for no args
+        if (args.length == 0) {
+            printVersion();
+            printUsage(System.out);
+            return false;
+        }
         for (int i = 0; i < args.length; i++) {
             if (args[i].equals("-x")
                        || args[i].equals("--dump-config")) {
@@ -314,7 +320,8 @@
             } else if (args[i].equals("-if")) {
                 i = i + parseIntermediateFormatOption(args, i);
             } else if (args[i].equals("-v")) {
-                System.out.println("FOP Version " + Version.getVersion());
+                printVersion();
+                return false;
             } else if (args[i].equals("-param")) {
                   if (i + 2 < args.length) {
                       String name = args[++i];
@@ -340,8 +347,8 @@
             } else if (!isOption(args[i])) {
                 i = i + parseUnknownOption(args, i);
             } else {
-                printUsage();
-                return false;
+                printUsage(System.err);
+                System.exit(1);
             }
         }
         return true;
@@ -1056,12 +1063,19 @@
         }
     }
 
+    private static void printVersion() {
+        System.out.println("FOP Version " + Version.getVersion());
+    }
+
     /**
-     * shows the commandline syntax including a summary of all available options and some
examples
+     * Shows the command line syntax including a summary of all available options and some
+     * examples.
+     *
+     * @param out the stream to which the message must be printed
      */
-    public static void printUsage() {
-        System.err.println(
-              "\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] "
+    public static void printUsage(PrintStream out) {
+        out.println(
+              "\nUSAGE\nfop [options] [-fo|-xml] infile [-xsl file] "
                     + "[-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>\n"
             + " [OPTIONS]  \n"
             + "  -d                debug mode   \n"
@@ -1123,15 +1137,15 @@
             + "                    XSL-FO file is saved and no rendering is performed. \n"
             + "                    (Only available if you use -xml and -xsl parameters)\n\n"
             + "\n"
-            + " [Examples]\n" + "  Fop foo.fo foo.pdf \n"
-            + "  Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)\n"
-            + "  Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf\n"
-            + "  Fop -xml foo.xml -xsl foo.xsl -foout foo.fo\n"
-            + "  Fop -xml - -xsl foo.xsl -pdf -\n"
-            + "  Fop foo.fo -mif foo.mif\n"
-            + "  Fop foo.fo -rtf foo.rtf\n"
-            + "  Fop foo.fo -print\n"
-            + "  Fop foo.fo -awt\n");
+            + " [Examples]\n" + "  fop foo.fo foo.pdf \n"
+            + "  fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)\n"
+            + "  fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf\n"
+            + "  fop -xml foo.xml -xsl foo.xsl -foout foo.fo\n"
+            + "  fop -xml - -xsl foo.xsl -pdf -\n"
+            + "  fop foo.fo -mif foo.mif\n"
+            + "  fop foo.fo -rtf foo.rtf\n"
+            + "  fop foo.fo -print\n"
+            + "  fop foo.fo -awt\n");
     }
 
     /**
@@ -1140,11 +1154,11 @@
     private void printUsagePrintOutput() {
         System.err.println("USAGE: -print [from[-to][,even|odd]] [-copies numCopies]\n\n"
            + "Example:\n"
-           + "all pages:                        Fop infile.fo -print\n"
-           + "all pages with two copies:        Fop infile.fo -print -copies 2\n"
-           + "all pages starting with page 7:   Fop infile.fo -print 7\n"
-           + "pages 2 to 3:                     Fop infile.fo -print 2-3\n"
-           + "only even page between 10 and 20: Fop infile.fo -print 10-20,even\n");
+           + "all pages:                        fop infile.fo -print\n"
+           + "all pages with two copies:        fop infile.fo -print -copies 2\n"
+           + "all pages starting with page 7:   fop infile.fo -print 7\n"
+           + "pages 2 to 3:                     fop infile.fo -print 2-3\n"
+           + "only even page between 10 and 20: fop infile.fo -print 10-20,even\n");
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/Main.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/Main.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/Main.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/Main.java
Tue Oct 21 01:58:08 2008
@@ -139,7 +139,10 @@
     }
 
     /**
-     * Executes FOP with the given ClassLoader setup.
+     * Executes FOP with the given arguments. If no argument is provided, returns its
+     * version number as well as a short usage statement; if '-v' is provided, returns its
+     * version number alone; if '-h' is provided, returns its short help message.
+     *
      * @param args command-line arguments
      */
     public static void startFOP(String[] args) {
@@ -153,7 +156,7 @@
         try {
             options = new CommandLineOptions();
             if (!options.parse(args)) {
-                System.exit(1);
+                System.exit(0);
             }
 
             foUserAgent = options.getFOUserAgent();

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
Tue Oct 21 01:58:08 2008
@@ -23,6 +23,7 @@
 import java.util.Map;
 
 import org.apache.batik.dom.svg.SVGDOMImplementation;
+
 import org.apache.xmlgraphics.image.loader.Image;
 import org.apache.xmlgraphics.image.loader.ImageException;
 import org.apache.xmlgraphics.image.loader.ImageFlavor;
@@ -45,8 +46,8 @@
      * @param targetFlavor the target flavor
      */
     public ImageLoaderSVG(ImageFlavor targetFlavor) {
-        if (!(XMLNamespaceEnabledImageFlavor.SVG_DOM.equals(targetFlavor))) {
-            throw new IllegalArgumentException("Unsupported target ImageFlavor: " + targetFlavor);
+        if (!(XMLNamespaceEnabledImageFlavor.SVG_DOM.isCompatible(targetFlavor))) {
+            throw new IllegalArgumentException("Incompatible target ImageFlavor: " + targetFlavor);
         }
         this.targetFlavor = targetFlavor;
     }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java
Tue Oct 21 01:58:08 2008
@@ -393,12 +393,15 @@
                         int width = area.getIPD();
                         width += backProps.getPaddingStart(false, context);
                         width += backProps.getPaddingEnd(false, context);
-                        back.setHoriz(backProps.backgroundPositionHorizontal.getValue(
-                                new SimplePercentBaseContext(context,
-                                    LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL,
-                                    (width - back.getImageInfo().getSize().getWidthMpt())
-                                )
-                            ));
+                        int imageWidthMpt = back.getImageInfo().getSize().getWidthMpt();
+                        int lengthBaseValue = width - imageWidthMpt;
+                        SimplePercentBaseContext simplePercentBaseContext
+                            = new SimplePercentBaseContext(context,
+                            LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL,
+                            lengthBaseValue);
+                        int horizontal = backProps.backgroundPositionHorizontal.getValue(
+                                simplePercentBaseContext);
+                        back.setHoriz(horizontal);
                     } else {
                         //TODO Area IPD has to be set for this to work
                         log.warn("Horizontal background image positioning ignored"
@@ -414,12 +417,15 @@
                         int height = area.getBPD();
                         height += backProps.getPaddingBefore(false, context);
                         height += backProps.getPaddingAfter(false, context);
-                        back.setVertical(backProps.backgroundPositionVertical.getValue(
-                                new SimplePercentBaseContext(context,
-                                     LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL,
-                                     (height - back.getImageInfo().getSize().getHeightMpt())
-                                )
-                            ));
+                        int imageHeightMpt = back.getImageInfo().getSize().getHeightMpt();
+                        int lengthBaseValue = height - imageHeightMpt;
+                        SimplePercentBaseContext simplePercentBaseContext
+                            = new SimplePercentBaseContext(context,
+                                LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL,
+                                lengthBaseValue);
+                        int vertical = backProps.backgroundPositionVertical.getValue(
+                                simplePercentBaseContext);
+                        back.setVertical(vertical);
                     } else {
                         //TODO Area BPD has to be set for this to work
                         log.warn("Vertical background image positioning ignored"

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
Tue Oct 21 01:58:08 2008
@@ -35,7 +35,9 @@
 import org.apache.batik.gvt.GraphicsNode;
 
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
+import org.apache.xmlgraphics.util.QName;
 
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.render.RendererContext.RendererContextWrapper;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
@@ -48,6 +50,10 @@
  */
 public abstract class AbstractGenericSVGHandler implements XMLHandler, RendererContextConstants
{
 
+    /** Qualified name for the "conversion-mode" extension attribute. */
+    protected static final QName CONVERSION_MODE = new QName(
+            ExtensionElementMapping.URI, null, "conversion-mode");
+
     /** {@inheritDoc} */
     public void handleXML(RendererContext context,
                 Document doc, String ns) throws Exception {

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java:699793-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFContentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFContentHandler.java:680381-699792
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFContentHandler.java:680381-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFPainter.java:680381-699792
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFPainter.java:680381-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFRenderer.java:680381-699792
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFRenderer.java:680381-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java:685127-699792
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java:685127-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java:685127-699792
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java:685127-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java:699793-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java:699793-706550

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLRenderer.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLRenderer.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLRenderer.java
Tue Oct 21 01:58:08 2008
@@ -59,6 +59,7 @@
 import org.apache.xmlgraphics.java2d.GraphicContext;
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
 import org.apache.xmlgraphics.util.QName;
+import org.apache.xmlgraphics.util.UnitConv;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.MimeConstants;
@@ -74,6 +75,7 @@
 import org.apache.fop.area.inline.ForeignObject;
 import org.apache.fop.area.inline.Image;
 import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.Leader;
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.area.inline.TextArea;
 import org.apache.fop.area.inline.Viewport;
@@ -96,7 +98,6 @@
 import org.apache.fop.render.java2d.Java2DRenderer;
 import org.apache.fop.render.pcl.extensions.PCLElementMapping;
 import org.apache.fop.traits.BorderProps;
-import org.apache.xmlgraphics.util.UnitConv;
 
 /* Note:
  * There are some commonalities with AbstractPathOrientedRenderer but it's not possible
@@ -1641,6 +1642,37 @@
         }
     }
 
+    /** {@inheritDoc} */
+    public void renderLeader(Leader area) {
+        renderInlineAreaBackAndBorders(area);
+
+        saveGraphicsState();
+        int style = area.getRuleStyle();
+        float startx = (currentIPPosition + area.getBorderAndPaddingWidthStart()) / 1000f;
+        float starty = (currentBPPosition + area.getOffset()) / 1000f;
+        float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart()
+                        + area.getIPD()) / 1000f;
+        float ruleThickness = area.getRuleThickness() / 1000f;
+        Color col = (Color)area.getTrait(Trait.COLOR);
+
+        switch (style) {
+            case EN_SOLID:
+            case EN_DASHED: //TODO Improve me and following (this is just a quick-fix ATM)
+            case EN_DOUBLE:
+            case EN_DOTTED:
+            case EN_GROOVE:
+            case EN_RIDGE:
+                updateFillColor(col);
+                fillRect(startx, starty, endx - startx, ruleThickness);
+                break;
+            default:
+                throw new UnsupportedOperationException("rule style not supported");
+        }
+
+        restoreGraphicsState();
+        super.renderLeader(area);
+    }
+
     /**
      * Controls whether all text should be generated as bitmaps or only text for which there's
      * no native font.

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java:699793-706550

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
Tue Oct 21 01:58:08 2008
@@ -67,8 +67,8 @@
         float imw = (float)dim.getWidth() / 1000f;
         float imh = (float)dim.getHeight() / 1000f;
 
-        float sx = fwidth / (float)imw;
-        float sy = fheight / (float)imh;
+        float sx = pdfInfo.paintAsBitmap ? 1.0f : (fwidth / (float)imw);
+        float sy = pdfInfo.paintAsBitmap ? 1.0f : (fheight / (float)imh);
 
         generator.comment("G2D start");
         generator.saveGraphicsState();

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
Tue Oct 21 01:58:08 2008
@@ -22,20 +22,31 @@
 import java.awt.Dimension;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.util.Map;
 
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
 import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
 import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.util.QName;
 
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.render.AbstractGraphics2DAdapter;
 import org.apache.fop.render.RendererContext;
+import org.apache.fop.render.RendererContextConstants;
+import org.apache.fop.render.RendererContext.RendererContextWrapper;
+import org.apache.fop.render.pdf.PDFRenderer;
 
 /**
  * Graphics2DAdapter implementation for PostScript.
  */
 public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter {
 
+    /** Qualified name for the "conversion-mode" extension attribute. */
+    protected static final QName CONVERSION_MODE = new QName(
+            ExtensionElementMapping.URI, null, "conversion-mode");
+
     private PSGenerator gen;
     private boolean clip = true;
 
@@ -71,8 +82,15 @@
         float imw = (float)dim.getWidth() / 1000f;
         float imh = (float)dim.getHeight() / 1000f;
 
-        float sx = fwidth / (float)imw;
-        float sy = fheight / (float)imh;
+        boolean paintAsBitmap = false;
+        if (context != null) {
+            Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+            paintAsBitmap = (foreign != null
+                   && "bitmap".equalsIgnoreCase((String)foreign.get(CONVERSION_MODE)));
+        }
+
+        float sx = paintAsBitmap ? 1.0f : (fwidth / (float)imw);
+        float sy = paintAsBitmap ? 1.0f : (fheight / (float)imh);
 
         gen.commentln("%FOPBeginGraphics2D");
         gen.saveGraphicsState();
@@ -95,8 +113,19 @@
         // scale to viewbox
         transform.translate(fx, fy);
         gen.getCurrentState().concatMatrix(transform);
-        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
-        painter.paint(graphics, area);
+        if (paintAsBitmap) {
+            //Fallback solution: Paint to a BufferedImage
+            int resolution = (int)Math.round(context.getUserAgent().getTargetResolution());
+            RendererContextWrapper ctx = RendererContext.wrapRendererContext(context);
+            BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false);
+
+            float scale = PDFRenderer.NORMAL_PDF_RESOLUTION
+                            / context.getUserAgent().getTargetResolution();
+            graphics.drawImage(bi, new AffineTransform(scale, 0, 0, scale, 0, 0), null);
+        } else {
+            Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
+            painter.paint(graphics, area);
+        }
 
         gen.restoreGraphicsState();
         gen.commentln("%FOPEndGraphics2D");

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSRenderer.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSRenderer.java
Tue Oct 21 01:58:08 2008
@@ -58,10 +58,10 @@
 import org.apache.xmlgraphics.ps.DSCConstants;
 import org.apache.xmlgraphics.ps.ImageEncoder;
 import org.apache.xmlgraphics.ps.PSDictionary;
-import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
 import org.apache.xmlgraphics.ps.PSDictionaryFormatException;
 import org.apache.xmlgraphics.ps.PSGenerator;
 import org.apache.xmlgraphics.ps.PSImageUtils;
+import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
 import org.apache.xmlgraphics.ps.PSProcSets;
 import org.apache.xmlgraphics.ps.PSResource;
 import org.apache.xmlgraphics.ps.PSState;
@@ -143,7 +143,7 @@
     /** The application producing the PostScript */
     private int currentPageNumber = 0;
 
-    private boolean enableComments = true;
+    private final boolean enableComments = true;
     private boolean autoRotateLandscape = false;
     private int languageLevel = PSGenerator.DEFAULT_LANGUAGE_LEVEL;
 
@@ -589,12 +589,12 @@
     /** {@inheritDoc} */
     public void paintImage(RenderedImage image, RendererContext context,
             int x, int y, int width, int height) throws IOException {
-        float fx = (float)x / 1000f;
+        float fx = x / 1000f;
         x += currentIPPosition / 1000f;
-        float fy = (float)y / 1000f;
+        float fy = y / 1000f;
         y += currentBPPosition / 1000f;
-        float fw = (float)width / 1000f;
-        float fh = (float)height / 1000f;
+        float fw = width / 1000f;
+        float fh = height / 1000f;
         PSImageUtils.renderBitmapImage(image, fx, fy, fw, fh, gen);
     }
 
@@ -1235,6 +1235,8 @@
                     PSExtensionAttachment attachment = (PSExtensionAttachment)attObj;
                     if (attachment instanceof PSCommentBefore) {
                         gen.commentln("%" + attachment.getContent());
+                    } else if (attachment instanceof PSSetupCode) {
+                        gen.writeln(attachment.getContent());
                     }
                 }
             }
@@ -1610,7 +1612,7 @@
      * {@inheritDoc}
      */
     public void renderImage(Image image, Rectangle2D pos) {
-        drawImage(image.getURL(), pos);
+        drawImage(image.getURL(), pos, image.getForeignAttributes());
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java
Tue Oct 21 01:58:08 2008
@@ -22,6 +22,7 @@
 // Java
 import java.awt.geom.AffineTransform;
 import java.io.IOException;
+import java.util.Map;
 
 import org.w3c.dom.Document;
 
@@ -39,6 +40,7 @@
 import org.apache.fop.render.AbstractGenericSVGHandler;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.render.RendererContext;
+import org.apache.fop.render.RendererContextConstants;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
 
@@ -226,6 +228,23 @@
         int yOffset = psInfo.currentYPosition;
         PSGenerator gen = psInfo.psGenerator;
 
+        boolean paintAsBitmap = false;
+        if (context != null) {
+            Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+            paintAsBitmap = (foreign != null
+                   && "bitmap".equalsIgnoreCase((String)foreign.get(CONVERSION_MODE)));
+        }
+        if (paintAsBitmap) {
+            try {
+                super.renderSVGDocument(context, doc);
+            } catch (IOException ioe) {
+                SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
+                        context.getUserAgent().getEventBroadcaster());
+                eventProducer.svgRenderingError(this, ioe, getDocumentURI(doc));
+            }
+            return;
+        }
+
         //Controls whether text painted by Batik is generated using text or path operations
         boolean strokeText = false;
         Configuration cfg = psInfo.getHandlerConfiguration();

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java?rev=706553&r1=706552&r2=706553&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java
Tue Oct 21 01:58:08 2008
@@ -20,21 +20,20 @@
 package org.apache.fop.render.ps.extensions;
 
 // FOP
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
 
 /**
  * Base class for the PostScript-specific extension elements.
  */
 public abstract class AbstractPSExtensionObject extends FONode {
 
-    private PSSetupCode setupCode = new PSSetupCode();
+    private final PSSetupCode setupCode = new PSSetupCode();
 
     /**
      * Main constructor.
@@ -56,9 +55,10 @@
     /** {@inheritDoc} */
     protected void characters(char[] data, int start, int length,
                                  PropertyList pList, Locator locator) {
-        if (setupCode.getContent() != null) {
-            StringBuffer sb = new StringBuffer(setupCode.getContent());
-            sb.append(data, start, length - start);
+        String content = setupCode.getContent();
+        if (content != null) {
+            StringBuffer sb = new StringBuffer(content);
+            sb.append(data, start, length);
             setupCode.setContent(sb.toString());
         } else {
             setupCode.setContent(new String(data, start, length));

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java:699793-706550

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 21 01:58:08 2008
@@ -0,0 +1 @@
+/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java:699793-706550



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


Mime
View raw message