Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!haven!umd5!zben From: zben@umd5.umd.edu (Ben Cranston) Newsgroups: comp.lang.postscript Subject: Re: Need simple way to save/restore clip path Summary: Do clippath and walk with pathforall Keywords: clip path Message-ID: <5001@umd5.umd.edu> Date: 13 Jun 89 17:36:01 GMT References: <676@ztivax.UUCP> Reply-To: zben@umd5.umd.edu (Ben Cranston) Organization: University of Maryland, College Park Lines: 20 The Postscript "clippath" verb makes the current path into a copy of the current clipping path. The "pathforall" verb walks the current path calling one of four routines you supply. There is one called for "move", one for "line", one for "curve", and one for "close". These routines can build a data structure which you can then pull later. I have seen this technique used to build a procedure body on the stack that when later bound to a name and called restores the clipping path to that which was in effect when the technique was used. This is in Apple's laserwriter prologue from printing 5.2 (prologue level 68). If you can get a Macintosh command-K dump you could probably extract much of the code from that. Look in the "od" procedure, which seems to bind the name "gc" to the enumerated path (the transform-itransform is snapping to integer device coordinates). N.B. This technique is deliberately and specifically DISallowed when the outline of an Adobe character is in the clipping path. This is to prevent you from stealing the Adobe fonts... -- Ben Cranston (Kingdom of Merryland UniSys 1100/92) Copyright 1989 (you may redistribute ONLY if your recipients can).