Author: jeremias
Date: Sun Jan 11 03:19:13 2009
New Revision: 733451
URL: http://svn.apache.org/viewvc?rev=733451&view=rev
Log:
Moved getPoint() method from DataStream to AFPPaintingState where it makes more
sense.
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/AFPPaintingState.java
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/DataStream.java
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/AFPPaintingState.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=733451&r1=733450&r2=733451&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/AFPPaintingState.java
(original)
+++
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/AFPPaintingState.java
Sun Jan 11 03:19:13 2009
@@ -19,8 +19,11 @@
package org.apache.fop.afp;
+import java.awt.Point;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.afp.fonts.AFPPageFonts;
import org.apache.fop.util.AbstractPaintingState;
@@ -53,7 +56,7 @@
private int resolution = 240; // 240 dpi
/** the current page */
- private AFPPagePaintingState pagePaintingState = new
AFPPagePaintingState();
+ private transient AFPPagePaintingState pagePaintingState = new
AFPPagePaintingState();
// /** reference orientation */
// private int orientation = 0;
@@ -313,6 +316,37 @@
return this.unitConv;
}
+ /**
+ * Returns a point on the current page, taking the current painting state
into account.
+ *
+ * @param x the X-coordinate
+ * @param y the Y-coordinate
+ * @return a point on the current page
+ */
+ public Point getPoint(int x, int y) {
+ Point p = new Point();
+ int rotation = getRotation();
+ switch (rotation) {
+ case 90:
+ p.x = y;
+ p.y = getPageWidth() - x;
+ break;
+ case 180:
+ p.x = getPageWidth() - x;
+ p.y = getPageHeight() - y;
+ break;
+ case 270:
+ p.x = getPageHeight() - y;
+ p.y = x;
+ break;
+ default:
+ p.x = x;
+ p.y = y;
+ break;
+ }
+ return p;
+ }
+
/** {...@inheritdoc} */
public Object clone() {
AFPPaintingState paintingState = (AFPPaintingState)super.clone();
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/DataStream.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/DataStream.java?rev=733451&r1=733450&r2=733451&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/DataStream.java
(original)
+++
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/afp/DataStream.java
Sun Jan 11 03:19:13 2009
@@ -29,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.afp.fonts.AFPFont;
import org.apache.fop.afp.fonts.AFPFontAttributes;
import org.apache.fop.afp.modca.AbstractPageObject;
@@ -339,27 +340,7 @@
* @return a point on the current page
*/
private Point getPoint(int x, int y) {
- Point p = new Point();
- int rotation = paintingState.getRotation();
- switch (rotation) {
- case 90:
- p.x = y;
- p.y = currentPage.getWidth() - x;
- break;
- case 180:
- p.x = currentPage.getWidth() - x;
- p.y = currentPage.getHeight() - y;
- break;
- case 270:
- p.x = currentPage.getHeight() - y;
- p.y = x;
- break;
- default:
- p.x = x;
- p.y = y;
- break;
- }
- return p;
+ return paintingState.getPoint(x, y);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]