aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-01-17 13:37:04 +0000
committerJeremias Maerki <jeremias@apache.org>2008-01-17 13:37:04 +0000
commit341da37f0397ee32757588ffe5d72b63ef51db5b (patch)
tree98ce246936721a8df7b736698cfc0328ad5c86b6 /src/java/org/apache/fop/area
parent5b110dff04202cb6e9fd4181e231715b96372cc6 (diff)
downloadxmlgraphics-fop-341da37f0397ee32757588ffe5d72b63ef51db5b.tar.gz
xmlgraphics-fop-341da37f0397ee32757588ffe5d72b63ef51db5b.zip
Fixed logic error setting the transformation matrix for block-container viewports (applies to absolute and fixed block-containers only). The CTM now only rotates and shifts the content as necessary for reference-orientation and writing-mode. All the rest of the transformation is done by the renderer which allows to add additional transformations as made possible by fox:transform (see below).
Important: External renderer implementations need to adjust for the change and implement the new method concatenateTransformationMatrix(AffineTransform) if the renderer is derived from AbstractPathOrientedRenderer. New extension attribute fox:transform on fo:block-container allows free-form transformation (rotation, scaling etc.) of absolute and fixed block-containers. Supported only for PDF, PS and Java2D-based renderers. Added missing region background painting for PCL renderer. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@612815 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r--src/java/org/apache/fop/area/CTM.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/area/CTM.java b/src/java/org/apache/fop/area/CTM.java
index d27e4ca20..c9fb52311 100644
--- a/src/java/org/apache/fop/area/CTM.java
+++ b/src/java/org/apache/fop/area/CTM.java
@@ -20,6 +20,7 @@
package org.apache.fop.area;
import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
@@ -101,6 +102,22 @@ public class CTM implements Serializable {
}
/**
+ * Initialize a CTM with the values of an AffineTransform.
+ *
+ * @param at the transformation matrix
+ */
+ public CTM(AffineTransform at) {
+ double[] matrix = new double[6];
+ at.getMatrix(matrix);
+ this.a = matrix[0];
+ this.b = matrix[1];
+ this.c = matrix[2];
+ this.d = matrix[3];
+ this.e = matrix[4];
+ this.f = matrix[5];
+ }
+
+ /**
* Return a CTM which will transform coordinates for a particular writing-mode
* into normalized first quandrant coordinates.
* @param wm A writing mode constant from fo.properties.WritingMode, ie.
@@ -246,6 +263,14 @@ public class CTM implements Serializable {
}
/**
+ * Returns this CTM as an AffineTransform object.
+ * @return the AffineTransform representation
+ */
+ public AffineTransform toAffineTransform() {
+ return new AffineTransform(toArray());
+ }
+
+ /**
* Construct a coordinate transformation matrix (CTM).
* @param absRefOrient absolute reference orientation
* @param writingMode the writing mode