You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/02/22 18:55:34 UTC
svn commit: r1731703 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
Author: tilman
Date: Mon Feb 22 17:55:34 2016
New Revision: 1731703
URL: http://svn.apache.org/viewvc?rev=1731703&view=rev
Log:
PDFBOX-3245: Add fill and stroke operators
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java?rev=1731703&r1=1731702&r2=1731703&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java Mon Feb 22 17:55:34 2016
@@ -1700,7 +1700,7 @@ public final class PDPageContentStream i
}
/**
- * Fills the path using the nonzero winding rule.
+ * Fills the path using the nonzero winding number rule.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a text block.
@@ -1724,12 +1724,80 @@ public final class PDPageContentStream i
{
if (inTextMode)
{
- throw new IllegalStateException("Error: fill is not allowed within a text block.");
+ throw new IllegalStateException("Error: fillEvenOdd is not allowed within a text block.");
}
writeOperator("f*");
}
/**
+ * Fill and then stroke the path, using the nonzero winding number rule to determine the region
+ * to fill. This shall produce the same result as constructing two identical path objects,
+ * painting the first with {@link #fill() } and the second with {@link #stroke() }.
+ *
+ * @throws IOException If the content stream could not be written
+ * @throws IllegalStateException If the method was called within a text block.
+ */
+ public void fillAndStroke() throws IOException
+ {
+ if (inTextMode)
+ {
+ throw new IllegalStateException("Error: fillAndStroke is not allowed within a text block.");
+ }
+ writeOperator("B");
+ }
+
+ /**
+ * Fill and then stroke the path, using the even-odd rule to determine the region to
+ * fill. This shall produce the same result as constructing two identical path objects, painting
+ * the first with {@link #fillEvenOdd() } and the second with {@link #stroke() }.
+ *
+ * @throws IOException If the content stream could not be written
+ * @throws IllegalStateException If the method was called within a text block.
+ */
+ public void fillAndStrokeEvenOdd() throws IOException
+ {
+ if (inTextMode)
+ {
+ throw new IllegalStateException("Error: fillAndStrokeEvenOdd is not allowed within a text block.");
+ }
+ writeOperator("B*");
+ }
+
+ /**
+ * Close, fill, and then stroke the path, using the nonzero winding number rule to determine the
+ * region to fill. This shall have the same effect as the sequence {@link #closePath() }
+ * and then {@link #fillAndStroke() }.
+ *
+ * @throws IOException If the content stream could not be written
+ * @throws IllegalStateException If the method was called within a text block.
+ */
+ public void closeAndFillAndStroke() throws IOException
+ {
+ if (inTextMode)
+ {
+ throw new IllegalStateException("Error: closeAndFillAndStroke is not allowed within a text block.");
+ }
+ writeOperator("b");
+ }
+
+ /**
+ * Close, fill, and then stroke the path, using the even-odd rule to determine the region to
+ * fill. This shall have the same effect as the sequence {@link #closePath() }
+ * and then {@link #fillAndStrokeEvenOdd() }.
+ *
+ * @throws IOException If the content stream could not be written
+ * @throws IllegalStateException If the method was called within a text block.
+ */
+ public void closeAndFillAndStrokeEvenOdd() throws IOException
+ {
+ if (inTextMode)
+ {
+ throw new IllegalStateException("Error: closeAndFillAndStrokeEvenOdd is not allowed within a text block.");
+ }
+ writeOperator("b*");
+ }
+
+ /**
* Fills the clipping area with the given shading.
*
* @param shading Shading resource