Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Carlos Newsgroups: comp.lang.postscript Subject: Re: Saving currentpoint and CTM Date: Fri, 20 May 2016 22:58:42 +0200 Organization: A noiseless patient Spider Lines: 28 Message-ID: <20160520225842.2a5f4a15@samara.DOMA> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: mx02.eternal-september.org; posting-host="14ae01f255251c16afab023606f4d0b9"; logging-data="28126"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NfIM77ggHEzZyfQeN9lBLY/b/FHDRbuY=" X-Newsreader: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Cancel-Lock: sha1:4VUcHv5LzKBvnUpHqzaR8hLaMnU= Xref: csiph.com comp.lang.postscript:2579 [Andre Majorel , 2016-05-20 16:28] > Is there a way to save (and later restore) currentpoint and the > CTM, so that after restoring, you can resume adding to the path > as if no moves or rotations had happened since you saved ? > > Rather not use gsave/grestore because > 1. it saves and restores more things than I want, such as the path, > 2. it is saved on the stack and I would prefer a dictionary of > arrays or something like that which would give me the freedom > of saving multiple times and restoring in any order without > burdening my feeble brain. > > Thanks in advance. > Do you mean something like this? /savepos { [ currentpoint 6 array currentmatrix ] } def /restorepos { aload pop setmatrix moveto } def E.g., 100 100 moveto 100 0 rlineto /x savepos def 0 20 260 { x restorepos rotate 50 0 rlineto } for showpage --