keiron 2002/07/23 04:00:26 Modified: src/org/apache/fop/pdf PDFState.java Log: handles clip better added method to restore to a level Revision Changes Path 1.6 +24 -3 xml-fop/src/org/apache/fop/pdf/PDFState.java Index: PDFState.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFState.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- PDFState.java 4 Jul 2002 14:08:19 -0000 1.5 +++ PDFState.java 23 Jul 2002 11:00:26 -0000 1.6 @@ -11,6 +11,8 @@ 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 @@ 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 @@ 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) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]