You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by kl...@apache.org on 2002/02/18 23:49:22 UTC
cvs commit: xml-fop/src/org/apache/fop/fo/pagination RegionBody.java SimplePageMaster.java
klease 02/02/18 14:49:22
Modified: src/org/apache/fop/area CTM.java
src/org/apache/fop/fo PropertyManager.java
src/org/apache/fop/fo/pagination RegionBody.java
SimplePageMaster.java
Log:
Fix some bugs in the CTM logic
Revision Changes Path
1.2 +50 -11 xml-fop/src/org/apache/fop/area/CTM.java
Index: CTM.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/CTM.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CTM.java 17 Feb 2002 21:59:29 -0000 1.1
+++ CTM.java 18 Feb 2002 22:49:22 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: CTM.java,v 1.1 2002/02/17 21:59:29 klease Exp $
+ * $Id: CTM.java,v 1.2 2002/02/18 22:49:22 klease Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -21,9 +21,9 @@
public class CTM implements Serializable {
private double a,b,c,d,e,f;
- private static CTM s_CTM_lrtb = new CTM(1,0,0,-1,0,0);
- private static CTM s_CTM_rltb = new CTM(-1,0,0,-1,0,0);
- private static CTM s_CTM_tbrl = new CTM(0,-1,-1,0,0,0);
+ private static CTM s_CTM_lrtb = new CTM(1,0,0,1,0,0);
+ private static CTM s_CTM_rltb = new CTM(-1,0,0,1,0,0);
+ private static CTM s_CTM_tbrl = new CTM(0,1,-1,0,0,0);
/**
* Create the identity matrix
*/
@@ -61,6 +61,15 @@
this.f = y;
}
+ protected CTM(CTM ctm) {
+ this.a = ctm.a;
+ this.b = ctm.b;
+ this.c = ctm.c;
+ this.d = ctm.d;
+ this.e = ctm.e;
+ this.f = ctm.f;
+ }
+
/**
* Return a CTM which will transform coordinates for a particular writing-mode
* into normalized first quandrant coordinates.
@@ -72,13 +81,24 @@
* CTM is being set.
*/
static public CTM getWMctm(int wm, int ipd, int bpd) {
+ CTM wmctm;
switch (wm) {
case WritingMode.LR_TB:
- return s_CTM_lrtb.translate(0,bpd);
+ return new CTM(s_CTM_lrtb);
case WritingMode.RL_TB:
- return s_CTM_rltb.translate(ipd, bpd);
+ {
+ wmctm = new CTM(s_CTM_rltb);
+ wmctm.e = ipd;
+ return wmctm;
+ }
+ //return s_CTM_rltb.translate(ipd, 0);
case WritingMode.TB_RL: // CJK
- return s_CTM_tbrl.translate(bpd, ipd);
+ {
+ wmctm = new CTM(s_CTM_tbrl);
+ wmctm.e = bpd;
+ return wmctm;
+ }
+ //return s_CTM_tbrl.translate(0, ipd);
default:
return null;
}
@@ -110,10 +130,25 @@
* @return CTM The result of rotating this CTM.
*/
public CTM rotate(double angle) {
- double rad = Math.toRadians(angle);
- double cos = Math.cos(rad);
- double sin = Math.sin(rad);
- CTM rotate= new CTM(cos, sin, -sin, cos, 0, 0);
+ double cos, sin;
+ if (angle == 90.0) {
+ cos = 0.0;
+ sin = 1.0;
+ }
+ else if (angle == 270.0) {
+ cos = 0.0;
+ sin = -1.0;
+ }
+ else if (angle == 180.0) {
+ cos = -1.0;
+ sin = 0.0;
+ }
+ else {
+ double rad = Math.toRadians(angle);
+ cos = Math.cos(rad);
+ sin = Math.sin(rad);
+ }
+ CTM rotate= new CTM(cos,-sin, sin, cos, 0, 0);
return multiply(rotate);
}
@@ -166,5 +201,9 @@
y1t = tmp;
}
return new Rectangle(x1t, y1t, x2t-x1t, y2t-y1t);
+ }
+
+ public String toString() {
+ return "[" + a + " " + b + " " + c + " " + d + " " + e + " " + f + "]";
}
}
1.9 +4 -3 xml-fop/src/org/apache/fop/fo/PropertyManager.java
Index: PropertyManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PropertyManager.java 17 Feb 2002 21:59:30 -0000 1.8
+++ PropertyManager.java 18 Feb 2002 22:49:22 -0000 1.9
@@ -1,5 +1,5 @@
/*
- * $Id: PropertyManager.java,v 1.8 2002/02/17 21:59:30 klease Exp $
+ * $Id: PropertyManager.java,v 1.9 2002/02/18 22:49:22 klease Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -278,19 +278,20 @@
* (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(height, 0); // height = absVPrect.width
+ ctm = ctm.translate(0, width); // width = absVPrect.height
break;
case 180:
ctm = ctm.translate(width, height);
break;
case 270:
- ctm = ctm.translate(0, width); // width = absVPrect.height
+ ctm = ctm.translate(height,0); // height = absVPrect.width
break;
}
ctm = ctm.rotate(absRefOrient);
1.16 +11 -1 xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java
Index: RegionBody.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- RegionBody.java 17 Feb 2002 21:59:30 -0000 1.15
+++ RegionBody.java 18 Feb 2002 22:49:22 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: RegionBody.java,v 1.15 2002/02/17 21:59:30 klease Exp $
+ * $Id: RegionBody.java,v 1.16 2002/02/18 22:49:22 klease Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -36,9 +36,18 @@
// Need these in writing-mode relative coordinates
// Or shall we get absolute and transform to relative using writing mode?
MarginProps mProps = propMgr.getMarginProps();
+ /**
+ System.err.println("BodyRegion margin props=" + mProps.startIndent + ","
+ + mProps.spaceBefore + "," + mProps.endIndent + ","
+ + mProps.spaceAfter);
+
return new Rectangle( mProps.startIndent, mProps.spaceBefore,
reldims.ipd - mProps.startIndent - mProps.endIndent,
reldims.bpd - mProps.spaceBefore - mProps.spaceAfter);
+ **/
+ return new Rectangle( mProps.marginLeft, mProps.marginTop,
+ reldims.ipd - mProps.marginLeft - mProps.marginRight,
+ reldims.bpd - mProps.marginTop - mProps.marginBottom);
}
protected void setRegionTraits(RegionReference r, Rectangle2D absRegVPRect) {
@@ -66,6 +75,7 @@
public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
// Should set some column stuff here I think, or put it elsewhere
BodyRegion body = new BodyRegion();
+ setRegionTraits(body, absRegVPRect);
int columnCount=
this.properties.get("column-count").getNumber().intValue();
if ((columnCount > 1) && (overflow == Overflow.SCROLL)) {
1.23 +2 -2 xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
Index: SimplePageMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SimplePageMaster.java 17 Feb 2002 21:59:30 -0000 1.22
+++ SimplePageMaster.java 18 Feb 2002 22:49:22 -0000 1.23
@@ -1,5 +1,5 @@
/*
- * $Id: SimplePageMaster.java,v 1.22 2002/02/17 21:59:30 klease Exp $
+ * $Id: SimplePageMaster.java,v 1.23 2002/02/18 22:49:22 klease Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -85,7 +85,7 @@
* The media rectangle itself is (0,0,pageWidth,pageHeight).
*/
Rectangle pageRefRect =
- new Rectangle(mProps.marginLeft, mProps.marginBottom,
+ new Rectangle(mProps.marginLeft, mProps.marginTop,
pageWidth - mProps.marginLeft - mProps.marginRight,
pageHeight - mProps.marginTop - mProps.marginBottom);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org