[FOray-commit] SF.net SVN: foray:[11833] trunk/foray/foray-pdf/src/main/java/org/foray/ pdf
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2021-01-19 22:03:49
|
Revision: 11833
http://sourceforge.net/p/foray/code/11833
Author: victormote
Date: 2021-01-19 22:03:46 +0000 (Tue, 19 Jan 2021)
Log Message:
-----------
Move some constants to the constants class.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfConstants.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfConstants.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfConstants.java 2021-01-19 13:54:52 UTC (rev 11832)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/PdfConstants.java 2021-01-19 22:03:46 UTC (rev 11833)
@@ -163,6 +163,15 @@
/** The maximum value for an object generation. */
public static final int MAX_OBJECT_GENERATION = 65535;
+ /** Constant indicating the number of elements in a cubic element, which is {@value}. */
+ public static final byte QTY_ELEMENTS_CUBIC = 6;
+
+ /** Constant indicating the number of elements in a quad element, which is {@value}. */
+ public static final byte QTY_ELEMENTS_QUAD = 4;
+
+ /** Constant indicating the number of elements in a linear element, which is {@value}. */
+ public static final byte QTY_ELEMENTS_LINEAR = 2;
+
/**
* Private constructor. This is a utility class and should never be instantiated.
*/
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2021-01-19 13:54:52 UTC (rev 11832)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2021-01-19 22:03:46 UTC (rev 11833)
@@ -39,6 +39,7 @@
import org.foray.common.i18n.Orthography4a;
import org.foray.common.ps.PsColor;
import org.foray.common.ps.PsUtil;
+import org.foray.pdf.PdfConstants;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontOptions;
@@ -131,18 +132,6 @@
}
- /** Constant indicating the number of elements in a cubic element, that is,
- * 6. */
- public static final byte QTY_ELEMENTS_CUBIC = 6;
-
- /** Constant indicating the number of elements in a quad element, that is,
- * 4. */
- public static final byte QTY_ELEMENTS_QUAD = 4;
-
- /** Constant indicating the number of elements in a linear element, that is,
- * 2. */
- public static final byte QTY_ELEMENTS_LINEAR = 2;
-
/** The current stream to add PDF commands to. */
private CharacterOutputStream currentStream;
@@ -377,7 +366,7 @@
final Shape imclip = getClip();
writeClip(imclip);
final String matrixString = matrixToString(matrix,
- PdfGraphics2D.QTY_ELEMENTS_CUBIC);
+ PdfConstants.QTY_ELEMENTS_CUBIC);
this.write(matrixString + "cm");
this.restoreGraphicsState();
return true;
@@ -425,23 +414,19 @@
final int type = iter.currentSegment(vals);
switch (type) {
case PathIterator.SEG_CUBICTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_CUBIC);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_CUBIC);
this.write(matrixString + "c");
break;
case PathIterator.SEG_LINETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "l");
break;
case PathIterator.SEG_MOVETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "m");
break;
case PathIterator.SEG_QUADTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_QUAD);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_QUAD);
this.write(matrixString + "y");
break;
case PathIterator.SEG_CLOSE:
@@ -467,28 +452,23 @@
final PathIterator iter = s.getPathIterator(getTransform());
String matrixString = null;
while (!iter.isDone()) {
- final double vals[] =
- new double[PsUtil.MATRIX_QTY_ELEMENTS];
+ final double vals[] = new double[PsUtil.MATRIX_QTY_ELEMENTS];
final int type = iter.currentSegment(vals);
switch (type) {
case PathIterator.SEG_CUBICTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_CUBIC);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_CUBIC);
this.write(matrixString + "c");
break;
case PathIterator.SEG_LINETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "l");
break;
case PathIterator.SEG_MOVETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "m");
break;
case PathIterator.SEG_QUADTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_QUAD);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_QUAD);
this.write(matrixString + "y");
break;
case PathIterator.SEG_CLOSE:
@@ -800,29 +780,24 @@
final PathIterator iter = s.getPathIterator(getTransform());
while (!iter.isDone()) {
- final double vals[] =
- new double[PsUtil.MATRIX_QTY_ELEMENTS];
+ final double vals[] = new double[PsUtil.MATRIX_QTY_ELEMENTS];
final int type = iter.currentSegment(vals);
String matrixString = null;
switch (type) {
case PathIterator.SEG_CUBICTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_CUBIC);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_CUBIC);
this.write(matrixString + "c");
break;
case PathIterator.SEG_LINETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "l");
break;
case PathIterator.SEG_MOVETO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_LINEAR);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_LINEAR);
this.write(matrixString + "m");
break;
case PathIterator.SEG_QUADTO:
- matrixString = matrixToString(vals,
- PdfGraphics2D.QTY_ELEMENTS_QUAD);
+ matrixString = matrixToString(vals, PdfConstants.QTY_ELEMENTS_QUAD);
this.write(matrixString + "y");
break;
case PathIterator.SEG_CLOSE:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|