Package org.apache.fop.render.pdf
Class CTMHelper
java.lang.Object
org.apache.fop.render.pdf.CTMHelper
CTMHelper converts FOP transformation matrices to those
suitable for use by the PDFRenderer. The e and f elements
of the matrix will be divided by 1000 as FOP uses millipoints
as it's default user space and PDF uses points.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]
toPDFArray
(CTM sourceMatrix) Creates an array of six doubles from the source CTM.static CTM
Creates a new CTM based in the sourceMatrix.static String
toPDFString
(AffineTransform transform, boolean convertMillipoints) Converts the AffineTransform instance to a string for use in the PDFRenderer cm operations.static String
toPDFString
(CTM sourceMatrix) Converts the sourceMatrix to a string for use in the PDFRenderer cm operations.
-
Method Details
-
toPDFString
Converts the sourceMatrix to a string for use in the PDFRenderer cm operations.
For example:
org.apache.fop.area.CTM ctm = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); String pdfMatrix = org.apache.fop.render.pdf.CTMHelper.toPDFString(ctm);
will return the string "1.0 0.0 0.0 1.0 1.0 1.0
".- Parameters:
sourceMatrix
- - The matrix to convert.- Returns:
- a space seperated string containing the matrix elements.
-
toPDFString
Converts the AffineTransform instance to a string for use in the PDFRenderer cm operations.
- Parameters:
transform
- The matrix to convert.convertMillipoints
- Indicates that the matrix needs to be converted from millipoints to points.- Returns:
- a space seperated string containing the matrix elements.
-
toPDFCTM
Creates a new CTM based in the sourceMatrix.
For example:
org.apache.fop.area.CTM inCTM = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); org.apache.fop.area.CTM outCTM = org.apache.fop.render.pdf.CTMHelper.toPDFCTM(ctm);
will return a new CTM where a == 1.0, b == 0.0, c == 0.0, d == 1.0, e == 1.0 and f == 1.0.- Parameters:
sourceMatrix
- - The matrix to convert.- Returns:
- a new converted matrix.
-
toPDFArray
Creates an array of six doubles from the source CTM.
For example:
org.apache.fop.area.CTM inCTM = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); double matrix[] = org.apache.fop.render.pdf.CTMHelper.toPDFArray(ctm);
will return a new array where matrix[0] == 1.0, matrix[1] == 0.0, matrix[2] == 0.0, matrix[3] == 1.0, matrix[4] == 1.0 and matrix[5] == 1.0.- Parameters:
sourceMatrix
- - The matrix to convert.- Returns:
- an array of doubles containing the converted matrix.
-