pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r720691 - in /incubator/pdfbox/trunk/src/main: java/org/apache/pdfbox/util/operator/ java/org/apache/pdfbox/util/operator/pagedrawer/ resources/Resources/
Date Wed, 26 Nov 2008 01:05:24 GMT
Author: jukka
Date: Tue Nov 25 17:05:23 2008
New Revision: 720691

URL: http://svn.apache.org/viewvc?rev=720691&view=rev
Log:
PDFBOX-389: Support for b*, B*, d, i, j and J operator

Patch by Andreas Lehmkühler.

Added:
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineCapStyle.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineJoinStyle.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineMiterLimit.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java
Modified:
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineDashPattern.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java
    incubator/pdfbox/trunk/src/main/resources/Resources/PageDrawer.properties

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineCapStyle.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineCapStyle.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineCapStyle.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineCapStyle.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.util.PDFOperator;
+
+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 $
+ */
+public class SetLineCapStyle extends org.apache.pdfbox.util.operator.OperatorProcessor
+{
+
+    /**
+     * Set the line cap style
+     * @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 arguments) throws IOException
+    {
+        int lineCapStyle = ((COSNumber)arguments.get( 0 )).intValue();
+        context.getGraphicsState().setLineCap( lineCapStyle );
+    }
+}

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineDashPattern.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineDashPattern.java?rev=720691&r1=720690&r2=720691&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineDashPattern.java
(original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineDashPattern.java
Tue Nov 25 17:05:23 2008
@@ -31,7 +31,7 @@
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.1 $
  */
-public class SetLineDashPattern extends org.apache.pdfbox.util.operator.SetLineWidth
+public class SetLineDashPattern extends org.apache.pdfbox.util.operator.OperatorProcessor
 {
 
     /**

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineJoinStyle.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineJoinStyle.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineJoinStyle.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineJoinStyle.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.util.PDFOperator;
+
+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 $
+ */
+public class SetLineJoinStyle extends org.apache.pdfbox.util.operator.OperatorProcessor
+{
+
+    /**
+     * Set the line cap style
+     * @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 arguments) throws IOException
+    {
+        int lineJoinStyle = ((COSNumber)arguments.get( 0 )).intValue();
+        context.getGraphicsState().setLineJoin( lineJoinStyle );
+    }
+}

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineMiterLimit.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineMiterLimit.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineMiterLimit.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/SetLineMiterLimit.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator;
+
+import java.util.List;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.util.PDFOperator;
+
+import java.io.IOException;
+
+/**
+ * <p>Structal modification of the PDFEngine class :
+ * the long sequence of conditions in processOperator is remplaced by
+ * this strategy pattern.</p>
+ *
+ * @author <a href="mailto:andreas@lehmi.de">Andreas Lehmkühler</a>
+ * @version $Revision: 1.0 $
+ */
+
+public class SetLineMiterLimit extends OperatorProcessor
+{
+    /**
+     * w Set miter limit.
+     * @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 arguments) throws IOException
+    {
+        COSNumber miterLimit = (COSNumber)arguments.get( 0 );
+        context.getGraphicsState().setMiterLimit( miterLimit.doubleValue() );
+    }
+}

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillEvenOddAndStrokePath.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.util.PDFOperator;
+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 $
+ */
+public class CloseFillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.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 arguments) throws IOException
+    {
+        context.processOperator( "h", arguments );
+
+        context.processOperator( "f*", arguments );
+
+        context.processOperator( "S", arguments );
+    }
+}

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java?rev=720691&r1=720690&r2=720691&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
(original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/CloseFillNonZeroAndStrokePath.java
Tue Nov 25 17:05:23 2008
@@ -30,7 +30,7 @@
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.1 $
  */
-public class CloseFillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.SetLineWidth
+public class CloseFillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor
 {
 
     /**

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillEvenOddAndStrokePath.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.pdfviewer.PageDrawer;
+import org.apache.pdfbox.util.PDFOperator;
+
+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 $
+ */
+public class FillEvenOddAndStrokePath extends org.apache.pdfbox.util.operator.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 arguments) throws IOException
+    {
+        PageDrawer drawer = (PageDrawer)context;
+        GeneralPath currentPath = (GeneralPath)drawer.getLinePath().clone();
+
+        context.processOperator( "f*", arguments );
+        drawer.setLinePath( currentPath );
+
+        context.processOperator( "S", arguments );
+    }
+}

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java?rev=720691&r1=720690&r2=720691&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
(original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/FillNonZeroAndStrokePath.java
Tue Nov 25 17:05:23 2008
@@ -30,7 +30,7 @@
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.1 $
  */
-public class FillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.SetLineWidth
+public class FillNonZeroAndStrokePath extends org.apache.pdfbox.util.operator.OperatorProcessor
 {
 
     /**

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineCapStyle.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdfviewer.PageDrawer;
+import org.apache.pdfbox.util.PDFOperator;
+
+import java.awt.BasicStroke;
+import java.awt.Graphics2D;
+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 $
+ */
+public class SetLineCapStyle extends org.apache.pdfbox.util.operator.SetLineCapStyle
+{
+
+    /**
+     * Set the line cap style
+     * @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 arguments) throws IOException
+    {
+        super.process( operator, arguments );
+        int lineCapStyle = context.getGraphicsState().getLineCap();
+        Graphics2D graphics = ((PageDrawer)context).getGraphics();
+        BasicStroke stroke = (BasicStroke)graphics.getStroke();
+        if (stroke == null)
+        	graphics.setStroke( new BasicStroke(1,lineCapStyle,BasicStroke.JOIN_MITER) );
+        else
+        	graphics.setStroke( new BasicStroke(stroke.getLineWidth(), lineCapStyle, stroke.getLineJoin(),
stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
+    }
+}

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineDashPattern.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdfviewer.PageDrawer;
+import org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern;
+import org.apache.pdfbox.util.PDFOperator;
+
+import java.awt.BasicStroke;
+import java.awt.Graphics2D;
+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 $
+ */
+public class SetLineDashPattern extends org.apache.pdfbox.util.operator.SetLineDashPattern
+{
+
+    /**
+     * Set the line dash pattern.
+     * @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 arguments) throws IOException
+    {
+        super.process( operator, arguments );
+        PDLineDashPattern dashPattern = context.getGraphicsState().getLineDashPattern();
+        Graphics2D graphics = ((PageDrawer)context).getGraphics();
+        BasicStroke stroke = (BasicStroke)graphics.getStroke();
+        if (stroke == null)
+        	graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER,
10.0f, dashPattern.getCOSDashPattern().toFloatArray(), dashPattern.getPhaseStart()) );
+        else
+        	graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(),
stroke.getMiterLimit(), dashPattern.getCOSDashPattern().toFloatArray(), dashPattern.getPhaseStart())
);
+    }
+}

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineJoinStyle.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.pdfviewer.PageDrawer;
+import org.apache.pdfbox.util.PDFOperator;
+
+import java.awt.BasicStroke;
+import java.awt.Graphics2D;
+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 $
+ */
+public class SetLineJoinStyle extends org.apache.pdfbox.util.operator.SetLineJoinStyle
+{
+
+    /**
+     * Set the line cap style
+     * @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 arguments) throws IOException
+    {
+        super.process( operator, arguments );
+        int lineJoinStyle = context.getGraphicsState().getLineJoin();
+        Graphics2D graphics = ((PageDrawer)context).getGraphics();
+        BasicStroke stroke = (BasicStroke)graphics.getStroke();
+        if (stroke == null)
+        	graphics.setStroke( new BasicStroke(1,BasicStroke.CAP_SQUARE,lineJoinStyle) );
+        else
+        	graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), lineJoinStyle,
stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
+    }
+}

Added: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java?rev=720691&view=auto
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java
(added)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineMiterLimit.java
Tue Nov 25 17:05:23 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator.pagedrawer;
+
+import java.util.List;
+
+import org.apache.pdfbox.pdfviewer.PageDrawer;
+import org.apache.pdfbox.util.PDFOperator;
+import java.awt.BasicStroke;
+import java.awt.Graphics2D;
+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 $
+ */
+public class SetLineMiterLimit extends org.apache.pdfbox.util.operator.SetLineMiterLimit
+{
+
+    /**
+     * Set the line dash pattern.
+     * @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 arguments) throws IOException
+    {
+        float miterLimit = (float)context.getGraphicsState().getMiterLimit();
+        Graphics2D graphics = ((PageDrawer)context).getGraphics();
+        BasicStroke stroke = (BasicStroke)graphics.getStroke();
+        if (stroke == null)
+        	graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER,
miterLimit, null, 0.0f) );
+        else
+        	graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(),
miterLimit, null, 0.0f) );
+    }
+}

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java?rev=720691&r1=720690&r2=720691&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java
(original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/SetLineWidth.java
Tue Nov 25 17:05:23 2008
@@ -21,6 +21,7 @@
 import org.apache.pdfbox.util.PDFOperator;
 
 import java.awt.BasicStroke;
+import java.awt.Graphics2D;
 import java.io.IOException;
 
 /**
@@ -46,6 +47,11 @@
         {
             lineWidth = 1;
         }
-        ((PageDrawer)context).getGraphics().setStroke( new BasicStroke( lineWidth ) );
+        Graphics2D graphics = ((PageDrawer)context).getGraphics();
+        BasicStroke stroke = (BasicStroke)graphics.getStroke();
+        if (stroke == null)
+        	graphics.setStroke( new BasicStroke( lineWidth ) );
+        else
+        	graphics.setStroke( new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(),
stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
     }
 }

Modified: incubator/pdfbox/trunk/src/main/resources/Resources/PageDrawer.properties
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/resources/Resources/PageDrawer.properties?rev=720691&r1=720690&r2=720691&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/resources/Resources/PageDrawer.properties (original)
+++ incubator/pdfbox/trunk/src/main/resources/Resources/PageDrawer.properties Tue Nov 25 17:05:23
2008
@@ -1,11 +1,11 @@
 # this Table is a correspondance Map of the PDF stream operators with concretes class of
the
-# OperatorProcessor abstract class for the stategy pattern used in the
+# OperatorProcessor abstract class for the stategy pattern used in the 
 # org.apache.pdfbox.util.PDFStreamEngine class.
 # To change the behaviour of the system, remplace the class name by a new class name.
 b=org.apache.pdfbox.util.operator.pagedrawer.CloseFillNonZeroAndStrokePath
 B=org.apache.pdfbox.util.operator.pagedrawer.FillNonZeroAndStrokePath
-#b* org.apache.pdfbox.util.operator.NotImplemented
-#B* org.apache.pdfbox.util.operator.NotImplemented
+b* org.apache.pdfbox.util.operator.pagedrawer.CloseFillEvenOddAndStrokePath
+B* org.apache.pdfbox.util.operator.pagedrawer.FillEvenOddAndStrokePath
 #BDC org.apache.pdfbox.util.operator.NotImplemented
 BI=org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage
 #BMC org.apache.pdfbox.util.operator.NotImplemented
@@ -15,7 +15,7 @@
 cm=org.apache.pdfbox.util.operator.Concatenate
 CS=org.apache.pdfbox.util.operator.SetStrokingColorSpace
 cs=org.apache.pdfbox.util.operator.SetNonStrokingColorSpace
-d=org.apache.pdfbox.util.operator.SetLineDashPattern
+d=org.apache.pdfbox.util.operator.pagedrawer.SetLineDashPattern
 #d0 org.apache.pdfbox.util.operator.NotImplemented
 #d1 org.apache.pdfbox.util.operator.NotImplemented
 Do=org.apache.pdfbox.util.operator.pagedrawer.Invoke
@@ -31,10 +31,10 @@
 g=org.apache.pdfbox.util.operator.SetNonStrokingGrayColor
 gs=org.apache.pdfbox.util.operator.SetGraphicsStateParameters
 h=org.apache.pdfbox.util.operator.pagedrawer.ClosePath
-#i org.apache.pdfbox.util.operator.NotImplemented
+i org.apache.pdfbox.util.operator.pagedrawer.SetLineMiterLimit
 #ID org.apache.pdfbox.util.operator.NotImplemented
-#j org.apache.pdfbox.util.operator.NotImplemented
-#J org.apache.pdfbox.util.operator.NotImplemented
+j org.apache.pdfbox.util.operator.pagedrawer.SetLineJoinStyle
+J org.apache.pdfbox.util.operator.pagedrawer.SetLineCapStyle
 K=org.apache.pdfbox.util.operator.SetStrokingCMYKColor
 k=org.apache.pdfbox.util.operator.SetNonStrokingCMYKColor
 l=org.apache.pdfbox.util.operator.pagedrawer.LineTo



Mime
View raw message