pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1571823 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: pdfviewer/ util/operator/ util/operator/pagedrawer/
Date Tue, 25 Feb 2014 21:09:52 GMT
Author: jahewson
Date: Tue Feb 25 21:09:51 2014
New Revision: 1571823

URL: http://svn.apache.org/r1571823
Log:
PDFBOX-1941: Refactor PageDrawer operators

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/OperatorProcessor.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java Tue Feb 25 21:09:51 2014
@@ -598,23 +598,6 @@ public class PageDrawer extends PDFStrea
         return linePath;
     }
 
-    /**
-     * Set the line path to draw.
-     * 
-     * @param newLinePath Set the line path to draw.
-     */
-    public void setLinePath(GeneralPath newLinePath)
-    {
-        if (linePath == null || linePath.getCurrentPoint() == null)
-        {
-            linePath = newLinePath;
-        }
-        else
-        {
-            linePath.append(newLinePath, false);
-        }
-    }
-
     // returns the stroking AWT Paint
     private Paint getStrokingPaint() throws IOException
     {
@@ -678,7 +661,7 @@ public class PageDrawer extends PDFStrea
         {
             LOG.info("ColorSpace " + getGraphicsState().getStrokingColorSpace().getName() +
                      " doesn't provide a stroking color, using white instead!");
-            strokingPaint = Color.WHITE;
+            strokingPaint = Color.WHITE;// ((PageDrawer)context).strokePath();
         }
         graphics.setPaint(strokingPaint);
         graphics.setStroke(getStroke());
@@ -713,6 +696,22 @@ public class PageDrawer extends PDFStrea
         linePath.reset();
     }
 
+    /**
+     * Strokes and fills the path.
+     *
+     * @param windingRule The winding rule this path will use.
+     *
+     * @throws IOException If there is an IO error while filling the path.
+     */
+    public void strokeAndFillPath(int windingRule) throws IOException
+    {
+        // TODO can we avoid cloning the path?
+        GeneralPath path = (GeneralPath)linePath.clone();
+        strokePath();
+        linePath = path;
+        fillPath(windingRule);
+    }
+
     // This code generalizes the code Jim Lynch wrote for AppendRectangleToPath
     /**
      * use the current transformation matrix to transform a single point.

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/OperatorProcessor.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/OperatorProcessor.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/OperatorProcessor.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/OperatorProcessor.java Tue Feb 25 21:09:51 2014
@@ -23,29 +23,24 @@ import java.util.List;
 import java.io.IOException;
 
 /**
- * @author Huault : huault@free.fr
- * @version $Revision: 1.3 $
+ * Processes a PDF operator.
+ * @author Laurent Huault
  */
 public abstract class OperatorProcessor
 {
-
-    /**
-     * The stream engine processing context.
-     */
+    /** The processing context. */
     protected PDFStreamEngine context = null;
 
     /**
-     * Constructor.
-     *
+     * Creates a new OperatorProcessor.
      */
     protected OperatorProcessor()
     {
     }
 
     /**
-     * Get the context for processing.
-     *
-     * @return The processing context.
+     * Returns the processing context.
+     * @return the processing context
      */
     protected PDFStreamEngine getContext()
     {
@@ -53,21 +48,19 @@ public abstract class OperatorProcessor
     }
 
     /**
-     * Set the processing context.
-     *
-     * @param ctx The context for processing.
+     * Sets the processing context.
+     * @param context the processing context.
      */
-    public void setContext(PDFStreamEngine ctx)
+    public void setContext(PDFStreamEngine context)
     {
-        context = ctx;
+        this.context = context;
     }
 
     /**
-     * process the operator.
-     * @param operator The operator that is being processed.
-     * @param arguments arguments needed by this operator.
-     *
-     * @throws IOException If there is an error processing the operator.
+     * Process the operator.
+     * @param operator the operator to process
+     * @param operands the operands to use when processing
+     * @throws IOException if the operator cannot be processed
      */
-    public abstract void process(PDFOperator operator, List<COSBase> arguments) throws IOException;
+    public abstract void process(PDFOperator operator, List<COSBase> operands) throws IOException;
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/AppendRectangleToPath.java Tue Feb 25 21:09:51 2014
@@ -27,54 +27,46 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * 
+ * re Appends a rectangle to the path.
+ * @author Ben Litchfield
  */
-public class AppendRectangleToPath extends OperatorProcessor
+public final class AppendRectangleToPath extends OperatorProcessor
 {
-
-
-    /**
-     * process : re : append rectangle to path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
         PageDrawer drawer = (PageDrawer)context;
 
-        COSNumber x = (COSNumber)arguments.get( 0 );
-        COSNumber y = (COSNumber)arguments.get( 1 );
-        COSNumber w = (COSNumber)arguments.get( 2 );
-        COSNumber h = (COSNumber)arguments.get( 3 );
+        COSNumber x = (COSNumber)operands.get(0);
+        COSNumber y = (COSNumber)operands.get(1);
+        COSNumber w = (COSNumber)operands.get(2);
+        COSNumber h = (COSNumber)operands.get(3);
 
         double x1 = x.doubleValue();
         double y1 = y.doubleValue();
-        // create a pair of coordinates for the transformation 
-        double x2 = w.doubleValue()+x1;
-        double y2 = h.doubleValue()+y1;
 
-        Point2D startCoords = drawer.transformedPoint(x1,y1);
-        Point2D endCoords = drawer.transformedPoint(x2,y2);
+        // create a pair of coordinates for the transformation
+        double x2 = w.doubleValue() + x1;
+        double y2 = h.doubleValue() + y1;
 
-        float width = (float)(endCoords.getX()-startCoords.getX());
-        float height = (float)(endCoords.getY()-startCoords.getY());
+        Point2D startCoords = drawer.transformedPoint(x1, y1);
+        Point2D endCoords = drawer.transformedPoint(x2, y2);
+
+        float width = (float)(endCoords.getX() - startCoords.getX());
+        float height = (float)(endCoords.getY() - startCoords.getY());
         float xStart = (float)startCoords.getX();
         float yStart = (float)startCoords.getY();
 
-        // To ensure that the path is created in the right direction,
-        // we have to create it by combining single lines instead of
-        // creating a simple rectangle
+        // to ensure that the path is created in the right direction, we have to create
+        // it by combining single lines instead of creating a simple rectangle
         GeneralPath path = drawer.getLinePath();
         path.moveTo(xStart, yStart);
-        path.lineTo(xStart+width, yStart);
-        path.lineTo(xStart+width, yStart+height);
-        path.lineTo(xStart, yStart+height);
-        // close the subpath instead of adding the last line
-        // so that a possible set line cap style isn't taken into account
-        // at the "beginning" of the rectangle
+        path.lineTo(xStart + width, yStart);
+        path.lineTo(xStart + width, yStart + height);
+        path.lineTo(xStart, yStart + height);
+
+        // close the subpath instead of adding the last line so that a possible set line
+        // cap style isn't taken into account at the "beginning" of the rectangle
         path.closePath();
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/BeginInlineImage.java Tue Feb 25 21:09:51 2014
@@ -20,8 +20,6 @@ import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.pdmodel.graphics.image.PDInlineImage;
@@ -30,19 +28,15 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Begins an inline image.
- *
+ * BI Begins an inline image.
  * @author Ben Litchfield
  */
-public class BeginInlineImage extends OperatorProcessor
+public final class BeginInlineImage extends OperatorProcessor
 {
     /**
-     * BI begin inline image.
-     * @param operator The operator that is being executed.
-     * @param arguments List
      * @throws IOException If there is an error displaying the inline image.
      */
-    public void process(PDFOperator operator, List<COSBase> arguments)  throws IOException
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
         PageDrawer drawer = (PageDrawer)context;
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipEvenOddRule.java Tue Feb 25 21:09:51 2014
@@ -17,48 +17,22 @@
 package org.apache.pdfbox.util.operator.pagedrawer;
 
 import java.awt.geom.GeneralPath;
-import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:Daniel.Wilson@BlackLocustSoftware.com">Daniel Wilson</a>
- * @version $Revision: 1.1 $
+ * W* Set clipping path using even odd rule.
+ * @author Daniel Wilson
  */
-public class ClipEvenOddRule extends OperatorProcessor
+public final class ClipEvenOddRule extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log LOG = LogFactory.getLog(ClipEvenOddRule.class);
-
-    /**
-     * process : W* : set clipping path using even odd rule.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException if there is an error during execution.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
-
-        try 
-        {
-            PageDrawer drawer = (PageDrawer)context;
-            drawer.setClippingWindingRule(GeneralPath.WIND_EVEN_ODD);
-        } 
-        catch (Exception e) 
-        {
-            LOG.warn(e, e);
-        }
+        ((PageDrawer)context).setClippingWindingRule(GeneralPath.WIND_EVEN_ODD);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClipNonZeroRule.java Tue Feb 25 21:09:51 2014
@@ -17,48 +17,22 @@
 package org.apache.pdfbox.util.operator.pagedrawer;
 
 import java.awt.geom.GeneralPath;
-import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:Daniel.Wilson@BlackLocustSoftware.com">Daniel Wilson</a>
- * @version $Revision: 1.1 $
+ * W Set the clipping path using non zero winding rule.
+ * @author Daniel Wilson
  */
 public class ClipNonZeroRule extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log LOG = LogFactory.getLog(ClipNonZeroRule.class);
-
-    /**
-     * process : W : Set the clipping path using non zero winding rule.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If there is an error during the processing.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
-
-        try 
-        {
-            PageDrawer drawer = (PageDrawer)context;
-            drawer.setClippingWindingRule(GeneralPath.WIND_NON_ZERO);
-        } 
-        catch (Exception e) 
-        {
-            LOG.warn(e, e);
-        }
+        ((PageDrawer)context).setClippingWindingRule(GeneralPath.WIND_NON_ZERO);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java Tue Feb 25 21:09:51 2014
@@ -20,29 +20,20 @@ import java.util.List;
 
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.util.PDFOperator;
+import org.apache.pdfbox.util.operator.OperatorProcessor;
+
 import java.io.IOException;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:andreas@lehmi.de">Andreas Lehmkühler</a>
- * @version $Revision: 1.0 $
+ * F Close, fill and stroke the path with even-odd winding rule.
+ * @author Andreas Lehmkühler
  */
-public class CloseFillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor
+public final class CloseFillEvenOddAndStrokePath extends OperatorProcessor
 {
-
-    /**
-     * fill and stroke the path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If an error occurs while processing the font.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        // execute ClosePath
-        context.processOperator( "h", arguments );
-        // execute FillEvenOddAndStroke
-        context.processOperator( "B*", arguments );
+        context.processOperator("h", operands);  // ClosePath
+        context.processOperator("B*", operands); // FillEvenOddAndStroke
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java Tue Feb 25 21:09:51 2014
@@ -24,26 +24,15 @@ import org.apache.pdfbox.util.operator.O
 import java.io.IOException;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.1 $
+ * b Close, fill and stroke the path with non-zero winding rule.
+ * @author Ben Litchfield
  */
-public class CloseFillNonZeroAndStrokePath extends OperatorProcessor
+public final class CloseFillNonZeroAndStrokePath extends OperatorProcessor
 {
-
-    /**
-     * fill and stroke the path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If an error occurs while processing the font.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        // execute ClosePath
-        context.processOperator( "h", arguments );
-        // execute FillNonZeroAndStroke
-        context.processOperator( "B", arguments );
+        context.processOperator("h", operands);  // ClosePath
+        context.processOperator("B", operands);  // FillNonZeroAndStroke
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/ClosePath.java Tue Feb 25 21:09:51 2014
@@ -17,46 +17,21 @@
 package org.apache.pdfbox.util.operator.pagedrawer;
 
 import java.util.List;
-import java.io.IOException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.3 $
+ * h Close the path.
+ * @author Ben Litchfield
  */
-public class ClosePath extends OperatorProcessor
+public final class ClosePath extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log log = LogFactory.getLog(ClosePath.class);
-
-    /**
-     * process : h : Close path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     * 
-     * @throws IOException if something went wrong during logging
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
-        PageDrawer drawer = (PageDrawer)context;
-        try
-        {
-            drawer.getLinePath().closePath();
-        }
-        catch( Throwable t )
-        {
-            log.warn(t, t);
-        }
+        ((PageDrawer)context).getLinePath().closePath();
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveTo.java Tue Feb 25 21:09:51 2014
@@ -26,36 +26,29 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * c Append curved segment to path.
+ * @author Ben Litchfield
  */
 public class CurveTo extends OperatorProcessor
 {
-
-
-    /**
-     * process : c : Append curved segment to path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
         PageDrawer drawer = (PageDrawer)context;
 
-        COSNumber x1 = (COSNumber)arguments.get( 0 );
-        COSNumber y1 = (COSNumber)arguments.get( 1 );
-        COSNumber x2 = (COSNumber)arguments.get( 2 );
-        COSNumber y2 = (COSNumber)arguments.get( 3 );
-        COSNumber x3 = (COSNumber)arguments.get( 4 );
-        COSNumber y3 = (COSNumber)arguments.get( 5 );
+        COSNumber x1 = (COSNumber)operands.get(0);
+        COSNumber y1 = (COSNumber)operands.get(1);
+        COSNumber x2 = (COSNumber)operands.get(2);
+        COSNumber y2 = (COSNumber)operands.get(3);
+        COSNumber x3 = (COSNumber)operands.get(4);
+        COSNumber y3 = (COSNumber)operands.get(5);
 
         Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue());
         Point2D point2 = drawer.transformedPoint(x2.doubleValue(), y2.doubleValue());
         Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue());
 
         drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(), 
-                (float)point2.getX(), (float)point2.getY(), (float)point3.getX(), (float)point3.getY());
+                                     (float)point2.getX(), (float)point2.getY(),
+                                     (float)point3.getX(), (float)point3.getY());
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateFinalPoint.java Tue Feb 25 21:09:51 2014
@@ -26,33 +26,26 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * y Append curved segment to path with final point replicated.
+ * @author Ben Litchfield
  */
-public class CurveToReplicateFinalPoint extends OperatorProcessor
+public final class CurveToReplicateFinalPoint extends OperatorProcessor
 {
-
-
-    /**
-     * process : y : Append curved segment to path (final point replicated).
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
         PageDrawer drawer = (PageDrawer)context;
 
-        COSNumber x1 = (COSNumber)arguments.get( 0 );
-        COSNumber y1 = (COSNumber)arguments.get( 1 );
-        COSNumber x3 = (COSNumber)arguments.get( 2 );
-        COSNumber y3 = (COSNumber)arguments.get( 3 );
+        COSNumber x1 = (COSNumber)operands.get(0);
+        COSNumber y1 = (COSNumber)operands.get(1);
+        COSNumber x3 = (COSNumber)operands.get(2);
+        COSNumber y3 = (COSNumber)operands.get(3);
 
         Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue());
         Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue());
 
         drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(), 
-                (float)point3.getX(), (float)point3.getY(), (float)point3.getX(), (float)point3.getY());
+                                     (float)point3.getX(), (float)point3.getY(),
+                                     (float)point3.getX(), (float)point3.getY());
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CurveToReplicateInitialPoint.java Tue Feb 25 21:09:51 2014
@@ -27,28 +27,20 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * v Append curved segment to path with the initial point replicated.
+ * @author Ben Litchfield
  */
 public class CurveToReplicateInitialPoint extends OperatorProcessor
 {
-
-
-    /**
-     * process : v : Append curved segment to path (initial point replicated).
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
         PageDrawer drawer = (PageDrawer)context;
 
-        COSNumber x2 = (COSNumber)arguments.get( 0 );
-        COSNumber y2 = (COSNumber)arguments.get( 1 );
-        COSNumber x3 = (COSNumber)arguments.get( 2 );
-        COSNumber y3 = (COSNumber)arguments.get( 3 );
+        COSNumber x2 = (COSNumber)operands.get(0 );
+        COSNumber y2 = (COSNumber)operands.get(1);
+        COSNumber x3 = (COSNumber)operands.get(2);
+        COSNumber y3 = (COSNumber)operands.get(3);
         GeneralPath path = drawer.getLinePath();
         Point2D currentPoint = path.getCurrentPoint();
 
@@ -56,6 +48,7 @@ public class CurveToReplicateInitialPoin
         Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue());
 
         drawer.getLinePath().curveTo((float)currentPoint.getX(), (float)currentPoint.getY(),
-                (float)point2.getX(), (float)point2.getY(), (float)point3.getX(), (float)point3.getY());
+                                     (float)point2.getX(),       (float)point2.getY(),
+                                     (float)point3.getX(),       (float)point3.getY());
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/EndPath.java Tue Feb 25 21:09:51 2014
@@ -24,23 +24,14 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * n End the path.
+ * @author Ben Litchfield
  */
-public class EndPath extends OperatorProcessor
+public final class EndPath extends OperatorProcessor
 {
-
-
-    /**
-     * process : n : End path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
-        PageDrawer drawer = (PageDrawer)context;
-        drawer.endPath();
+        ((PageDrawer)context).endPath();
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java Tue Feb 25 21:09:51 2014
@@ -21,34 +21,20 @@ import java.util.List;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
+import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 import java.awt.geom.GeneralPath;
 import java.io.IOException;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:andreas@lehmi.de">Andreas Lehmkühler</a>
- * @version $Revision: 101 $
+ * B* Fill and stroke the path.
+ * @author Andreas Lehmkühler
  */
-public class FillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor
+public final class FillEvenOddAndStrokePath extends OperatorProcessor
 {
-
-    /**
-     * fill and stroke the path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If an error occurs while processing the font.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        PageDrawer drawer = (PageDrawer)context;
-        GeneralPath currentPath = (GeneralPath)drawer.getLinePath().clone();
-
-        context.processOperator( "f*", arguments );
-        drawer.setLinePath( currentPath );
-
-        context.processOperator( "S", arguments );
+        ((PageDrawer)context).strokeAndFillPath(GeneralPath.WIND_EVEN_ODD);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java Tue Feb 25 21:09:51 2014
@@ -20,45 +20,20 @@ import java.awt.geom.GeneralPath;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.5 $
+ * f* Fill path using even odd rule.
+ * @author Ben Litchfield
  */
-public class FillEvenOddRule extends OperatorProcessor
+public final class FillEvenOddRule extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log log = LogFactory.getLog(FillEvenOddRule.class);
-
-    /**
-     * process : f* : fill path using even odd rule.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException if there is an error during execution.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        try 
-        {
-            ///dwilson refactoring
-            PageDrawer drawer = (PageDrawer)context;
-            drawer.fillPath(GeneralPath.WIND_EVEN_ODD);
-        } 
-        catch (Exception e) 
-        {
-            log.warn(e, e);
-        }
+        ((PageDrawer)context).fillPath(GeneralPath.WIND_EVEN_ODD);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java Tue Feb 25 21:09:51 2014
@@ -21,34 +21,20 @@ import java.util.List;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
+import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 import java.awt.geom.GeneralPath;
 import java.io.IOException;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.1 $
+ * B Fill and stroke the path using the non-zero winding rule.
+ * @author Ben Litchfield
  */
-public class FillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor
+public class FillNonZeroAndStrokePath extends OperatorProcessor
 {
-
-    /**
-     * fill and stroke the path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If an error occurs while processing the font.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        PageDrawer drawer = (PageDrawer)context;
-        GeneralPath currentPath = (GeneralPath)drawer.getLinePath().clone();
-
-        context.processOperator( "f", arguments );
-        drawer.setLinePath( currentPath );
-
-        context.processOperator( "S", arguments );
+        ((PageDrawer)context).strokeAndFillPath(GeneralPath.WIND_NON_ZERO);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroRule.java Tue Feb 25 21:09:51 2014
@@ -20,46 +20,20 @@ import java.awt.geom.GeneralPath;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
 import org.apache.pdfbox.util.PDFOperator;
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.5 $
+ * f,F Fill path using non zero winding rule.
+ * @author Ben Litchfield
  */
-public class FillNonZeroRule extends OperatorProcessor
+public final class FillNonZeroRule extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log log = LogFactory.getLog(FillNonZeroRule.class);
-
-    /**
-     * process : F/f : fill path using non zero winding rule.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If there is an error during the processing.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-
-        try 
-        {
-            ///dwilson refactoring
-            PageDrawer drawer = (PageDrawer)context;
-            drawer.fillPath(GeneralPath.WIND_NON_ZERO);
-        } 
-        catch (Exception e) 
-        {
-            log.warn(e, e);
-        }
+        ((PageDrawer)context).fillPath(GeneralPath.WIND_NON_ZERO);
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java Tue Feb 25 21:09:51 2014
@@ -41,25 +41,19 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- * 
+ * Do Draws an XObject.
  * @author Ben Litchfield
  * @author John Hewson
  */
-public class Invoke extends OperatorProcessor
+public final class Invoke extends OperatorProcessor
 {
     private static final Log LOG = LogFactory.getLog(Invoke.class);
 
-    /**
-     * Do: Paint the specified XObject.
-     * @param operator the operator that is being executed.
-     * @param arguments list
-     * @throws IOException if there is an error invoking the sub object.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
         PageDrawer drawer = (PageDrawer)context;
-        COSName objectName = (COSName)arguments.get(0);
+        COSName objectName = (COSName)operands.get(0);
         Map<String, PDXObject> xobjects = drawer.getResources().getXObjects();
         PDXObject xobject = xobjects.get(objectName.getName());
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/LineTo.java Tue Feb 25 21:09:51 2014
@@ -26,27 +26,19 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * l Append straight line segment to path.
+ * @author Ben Litchfield
  */
 public class LineTo extends OperatorProcessor
 {
-
-
-    /**
-     * process : l : Append straight line segment to path.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments)
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
         PageDrawer drawer = (PageDrawer)context;
 
-        //append straight line segment from the current point to the point.
-        COSNumber x = (COSNumber)arguments.get( 0 );
-        COSNumber y = (COSNumber)arguments.get( 1 );
+        // append straight line segment from the current point to the point
+        COSNumber x = (COSNumber)operands.get(0);
+        COSNumber y = (COSNumber)operands.get(1);
 
         Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue());
         drawer.getLinePath().lineTo((float)pos.getX(), (float)pos.getY());

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/MoveTo.java Tue Feb 25 21:09:51 2014
@@ -18,10 +18,7 @@ package org.apache.pdfbox.util.operator.
 
 import java.awt.geom.Point2D;
 import java.util.List;
-import java.io.IOException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSNumber;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
@@ -29,38 +26,18 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * m Begins a new subpath.
+ * @author Ben Litchfield
  */
-public class MoveTo extends OperatorProcessor
+public final class MoveTo extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log log = LogFactory.getLog(MoveTo.class);
-
-    /**
-     * process : m : Begin new subpath.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     * @throws IOException If there is an error processing the operator.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands)
     {
-        try
-        {
-            PageDrawer drawer = (PageDrawer)context;
-            COSNumber x = (COSNumber)arguments.get( 0 );
-            COSNumber y = (COSNumber)arguments.get( 1 );
-            Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue());
-            drawer.getLinePath().moveTo((float)pos.getX(), (float)pos.getY());
-        }
-        catch (Exception exception)
-        {
-            log.warn( exception, exception);
-        }
+        PageDrawer drawer = (PageDrawer)context;
+        COSNumber x = (COSNumber)operands.get(0);
+        COSNumber y = (COSNumber)operands.get(1);
+        Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue());
+        drawer.getLinePath().moveTo((float)pos.getX(), (float)pos.getY());
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SHFill.java Tue Feb 25 21:09:51 2014
@@ -19,8 +19,6 @@ package org.apache.pdfbox.util.operator.
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdfviewer.PageDrawer;
@@ -28,37 +26,14 @@ import org.apache.pdfbox.util.PDFOperato
 import org.apache.pdfbox.util.operator.OperatorProcessor;
 
 /**
- * Implementation of sh operator for page drawer.
- *  See section 4.6.3 of the PDF 1.7 specification.
- *
- * @author <a href="mailto:Daniel.Wilson@BlackLocustSoftware.com">Daniel Wilson</a>
- * @version $Revision: 1.0 $
+ * sh Fills the clipping area with the given shading pattern.
+ * @author Daniel Wilson
  */
-public class SHFill extends OperatorProcessor
+public final class SHFill extends OperatorProcessor
 {
-
-    /**
-     * Log instance.
-     */
-    private static final Log LOG = LogFactory.getLog(SHFill.class);
-
-    /**
-     * process : sh : shade fill the clipping area.
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException if there is an error during execution.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
-        try 
-        {
-            PageDrawer drawer = (PageDrawer)context;
-            drawer.shFill((COSName)(arguments.get(0)));
-        } 
-        catch (Exception e) 
-        {
-            LOG.warn(e, e);
-        }
+        ((PageDrawer)context).shFill((COSName)(operands.get(0)));
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java?rev=1571823&r1=1571822&r2=1571823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/StrokePath.java Tue Feb 25 21:09:51 2014
@@ -26,23 +26,13 @@ import org.apache.pdfbox.util.operator.O
 import java.io.IOException;
 
 /**
- * Implementation of content stream operator for page drawer.
- *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * 
+ * S Stroke the path.
+ * @author Ben Litchfield
  */
-public class StrokePath extends OperatorProcessor
+public final class StrokePath extends OperatorProcessor
 {
-
-    /**
-     * S stroke the path.
-     *
-     * @param operator The operator that is being executed.
-     * @param arguments List
-     *
-     * @throws IOException If an error occurs while processing the font.
-     */
-    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
+    @Override
+    public void process(PDFOperator operator, List<COSBase> operands) throws IOException
     {
         ((PageDrawer)context).strokePath();
     }



Mime
View raw message