diff options
author | William Victor Mote <vmote@apache.org> | 2003-08-23 19:26:30 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-08-23 19:26:30 +0000 |
commit | 8847eaaeb15250651a1fb848b22e17de3cba2af6 (patch) | |
tree | 014e02cabca7aa81da4a0a914bf078de77b4bd78 /src/java/org/apache/fop/fo | |
parent | 30d70cec7bf6f2e0e629d6b447578f6ee8a6375d (diff) | |
download | xmlgraphics-fop-8847eaaeb15250651a1fb848b22e17de3cba2af6.tar.gz xmlgraphics-fop-8847eaaeb15250651a1fb848b22e17de3cba2af6.zip |
move fo/PropertyManager.getCTMandRelDims() to area/CTM.getCTMandRelDims(), adding PropertyManager as a parameter, and making the method static.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196829 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyManager.java | 74 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Region.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/SimplePageMaster.java | 2 |
3 files changed, 4 insertions, 74 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java index 4f1d73e03..11d11c82e 100644 --- a/src/java/org/apache/fop/fo/PropertyManager.java +++ b/src/java/org/apache/fop/fo/PropertyManager.java @@ -52,11 +52,8 @@ package org.apache.fop.fo; // Java import java.text.MessageFormat; -import java.awt.geom.Rectangle2D; // FOP -import org.apache.fop.area.CTM; -import org.apache.fop.datatypes.FODimension; import org.apache.fop.fonts.Font; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginBlock; @@ -71,7 +68,6 @@ import org.apache.fop.traits.InlineProps; import org.apache.fop.traits.SpaceVal; import org.apache.fop.traits.LayoutProps; // keep, break, span, space? import org.apache.fop.fo.properties.Constants; -import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.fo.properties.Span; import org.apache.fop.fonts.FontMetrics; import org.apache.fop.fo.properties.CommonHyphenation; @@ -513,76 +509,10 @@ public class PropertyManager { } /** - * Construct a coordinate transformation matrix (CTM). - * @param absVPrect absolute viewpoint rectangle - * @param reldims relative dimensions - * @return CTM the coordinate transformation matrix (CTM) - */ - public CTM getCTMandRelDims(Rectangle2D absVPrect, - FODimension reldims) { - int width, height; - // We will use the absolute reference-orientation to set up the CTM. - // The value here is relative to its ancestor reference area. - int absRefOrient = getAbsRefOrient( - this.properties.get("reference-orientation").getNumber().intValue()); - if (absRefOrient % 180 == 0) { - width = (int) absVPrect.getWidth(); - height = (int) absVPrect.getHeight(); - } else { - // invert width and height since top left are rotated by 90 (cl or ccl) - height = (int) absVPrect.getWidth(); - width = (int) absVPrect.getHeight(); - } - /* Set up the CTM for the content of this reference area. - * This will transform region content coordinates in - * writing-mode relative into absolute page-relative - * which will then be translated based on the position of - * the region viewport. - * (Note: scrolling between region vp and ref area when - * doing online content!) - */ - CTM ctm = new CTM(absVPrect.getX(), absVPrect.getY()); - - // First transform for rotation - if (absRefOrient != 0) { - // Rotation implies translation to keep the drawing area in the - // first quadrant. Note: rotation is counter-clockwise - switch (absRefOrient) { - case 90: - ctm = ctm.translate(0, width); // width = absVPrect.height - break; - case 180: - ctm = ctm.translate(width, height); - break; - case 270: - ctm = ctm.translate(height, 0); // height = absVPrect.width - break; - } - ctm = ctm.rotate(absRefOrient); - } - int wm = this.properties.get("writing-mode").getEnum(); - /* Since we've already put adjusted width and height values for the - * top and left positions implied by the reference-orientation, we - * can set ipd and bpd appropriately based on the writing mode. - */ - - if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) { - reldims.ipd = width; - reldims.bpd = height; - } else { - reldims.ipd = height; - reldims.bpd = width; - } - // Set a rectangle to be the writing-mode relative version??? - // Now transform for writing mode - return ctm.multiply(CTM.getWMctm(wm, reldims.ipd, reldims.bpd)); - } - - /** * Calculate absolute reference-orientation relative to media orientation. */ - private int getAbsRefOrient(int myRefOrient) { + public int getAbsRefOrient(int myRefOrient) { return myRefOrient; } -} +} diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 10079df20..28d60211d 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -195,7 +195,7 @@ public abstract class Region extends FObj { */ protected void setRegionPosition(RegionReference r, Rectangle2D absRegVPRect) { FODimension reldims = new FODimension(0, 0); - r.setCTM(propMgr.getCTMandRelDims(absRegVPRect, reldims)); + r.setCTM(CTM.getCTMandRelDims(propMgr, absRegVPRect, reldims)); } /** diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 2d73df727..44eb03717 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -149,7 +149,7 @@ public class SimplePageMaster extends FObj { // Set up the CTM on the page reference area based on writing-mode // and reference-orientation FODimension reldims = new FODimension(0, 0); - CTM pageCTM = propMgr.getCTMandRelDims(pageRefRect, reldims); + CTM pageCTM = CTM.getCTMandRelDims(propMgr, pageRefRect, reldims); // Create a RegionViewport/ reference area pair for each page region |