Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #2583

Re: Saving currentpoint and CTM

From Andre Majorel <cheney@halliburton.com>
Newsgroups comp.lang.postscript
Subject Re: Saving currentpoint and CTM
Date 2016-05-21 17:52 +0000
Organization Dirac Angestun Gesept
Message-ID <slrnnk182v.4it.cheney@atc5.vermine.org> (permalink)
References <slrnnjueoi.4it.cheney@atc5.vermine.org> <20160520225842.2a5f4a15@samara.DOMA>

Show all headers | View raw


On 2016-05-20, Carlos <angus@quovadis.com.ar> wrote:
> [Andre Majorel <cheney@halliburton.com>, 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.
>
> 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

With you making it so simple, I feel stupid for not working it
out myself.

Yes, that it exactly what I wanted. Thanks everyone.

-- 
André Majorel http://www.teaser.fr/~amajorel/
J'ai des vrais problèmes, vous avez des faux problèmes.

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Saving currentpoint and CTM Andre Majorel <cheney@halliburton.com> - 2016-05-20 16:28 +0000
  Re: Saving currentpoint and CTM luser- -droog <mijoryx@yahoo.com> - 2016-05-20 11:52 -0700
    Re: Saving currentpoint and CTM luser- -droog <mijoryx@yahoo.com> - 2016-05-20 11:55 -0700
  Re: Saving currentpoint and CTM Carlos <angus@quovadis.com.ar> - 2016-05-20 22:58 +0200
    Re: Saving currentpoint and CTM Andre Majorel <cheney@halliburton.com> - 2016-05-21 17:52 +0000
  Re: Saving currentpoint and CTM jdaw1 <jdawiseman@gmail.com> - 2016-05-21 05:55 -0700

csiph-web