diff options
author | Keiron Liddle <keiron@apache.org> | 2002-06-18 13:42:56 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-06-18 13:42:56 +0000 |
commit | 64c1fb1421bb717edda576a916dc7a566967169c (patch) | |
tree | 106908e06d86a78e62b9bf364d76db1212a4483e /src/org/apache/fop/pdf/PDFState.java | |
parent | 84be81fe4e07fab92ccbcd8d77fbf4c6d66a8c71 (diff) | |
download | xmlgraphics-fop-64c1fb1421bb717edda576a916dc7a566967169c.tar.gz xmlgraphics-fop-64c1fb1421bb717edda576a916dc7a566967169c.zip |
implemented links in svg both for standalone and in fo documents
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194898 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/pdf/PDFState.java')
-rw-r--r-- | src/org/apache/fop/pdf/PDFState.java | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/org/apache/fop/pdf/PDFState.java b/src/org/apache/fop/pdf/PDFState.java index ddc66993d..45d91c5fb 100644 --- a/src/org/apache/fop/pdf/PDFState.java +++ b/src/org/apache/fop/pdf/PDFState.java @@ -10,9 +10,11 @@ package org.apache.fop.pdf; import java.awt.Shape; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.awt.Color; import java.awt.Paint; +import java.awt.geom.AffineTransform; /** * This keeps information about the current state when writing to pdf. @@ -57,7 +59,7 @@ public class PDFState { boolean text = false; int dashOffset = 0; int[] dashArray = new int[0]; - double[] transform = new double[]{1, 0, 0, 1, 0, 0}; + AffineTransform transform = new AffineTransform(); float fontSize = 0; String fontName = ""; Shape clip = null; @@ -89,6 +91,8 @@ public class PDFState { saveMap.put(CLIP, clip); stateStack.add(saveMap); + + transform = new AffineTransform(); } public void pop() { @@ -106,7 +110,7 @@ public class PDFState { text = ((Boolean)saveMap.get(TEXT)).booleanValue(); dashOffset = ((Integer)saveMap.get(DASHOFFSET)).intValue(); dashArray = (int[])saveMap.get(DASHARRAY); - transform = (double[])saveMap.get(TRANSFORM); + transform = (AffineTransform)saveMap.get(TRANSFORM); fontSize = ((Float)saveMap.get(FONTSIZE)).floatValue(); fontName = (String)saveMap.get(FONTNAME); clip = (Shape)saveMap.get(CLIP); @@ -165,17 +169,25 @@ public class PDFState { clip = cl; } - public boolean checkTransform(double[] vals) { - for(int count = 0; count < transform.length; count++) { - if(transform[count] != vals[count]) { - return true; - } - } - return false; + public boolean checkTransform(AffineTransform tf) { + return !tf.equals(transform); } - public void setTransform(double[] vals) { - transform = vals; + public void setTransform(AffineTransform tf) { + transform.concatenate(tf); + } + + public AffineTransform getTransform() { + AffineTransform tf; + AffineTransform at = new AffineTransform(); + for(Iterator iter = stateStack.iterator(); iter.hasNext(); ) { + HashMap map = (HashMap)iter.next(); + tf = (AffineTransform)map.get(TRANSFORM); + at.concatenate(tf); + } + at.concatenate(transform); + + return at; } } |