diff options
author | Keiron Liddle <keiron@apache.org> | 2002-07-23 11:00:26 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-07-23 11:00:26 +0000 |
commit | 3b6ecefad276b4b487961ea4079886e2e7a96277 (patch) | |
tree | e0fca1ddc401f20f9070e6cc47d1fe424d092e8f /src/org | |
parent | fc2fd3bb3660bd20b349b21ba9f279512a3893cd (diff) | |
download | xmlgraphics-fop-3b6ecefad276b4b487961ea4079886e2e7a96277.tar.gz xmlgraphics-fop-3b6ecefad276b4b487961ea4079886e2e7a96277.zip |
handles clip better
added method to restore to a level
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195022 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/apache/fop/pdf/PDFState.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/org/apache/fop/pdf/PDFState.java b/src/org/apache/fop/pdf/PDFState.java index ef5e73885..d9500c1b2 100644 --- a/src/org/apache/fop/pdf/PDFState.java +++ b/src/org/apache/fop/pdf/PDFState.java @@ -11,6 +11,8 @@ import java.awt.Shape; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.awt.geom.GeneralPath; +import java.awt.geom.Area; import java.awt.Color; import java.awt.Paint; @@ -125,6 +127,16 @@ public class PDFState { return stateStack.size(); } + public void restoreLevel(int stack) { + int pos = stack; + while(stateStack.size() > pos + 1) { + stateStack.remove(stateStack.size() - 1); + } + if(stateStack.size() > pos) { + pop(); + } + } + public boolean setLineDash(int[] array, int offset) { return false; } @@ -158,19 +170,28 @@ public class PDFState { return false; } + /** + * For clips it can start a new state + */ public boolean checkClip(Shape cl) { if(clip == null) { if(cl != null) { return true; } - } else if(!clip.equals(cl)) { + } else if(!new Area(clip).equals(new Area(cl))) { return true; } return false; } public void setClip(Shape cl) { - clip = cl; + if (clip != null) { + Area newClip = new Area(clip); + newClip.intersect(new Area(cl)); + clip = new GeneralPath(newClip); + } else { + clip = cl; + } } public boolean checkTransform(AffineTransform tf) { |