Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1425
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!feed.xsnews.nl!border-1.ams.xsnews.nl!post-feeder-02.xsnews.nl!frontend-F09-14.ams.news.kpn.nl |
|---|---|
| From | Cecil Westerhof <Cecil@decebal.nl> |
| Newsgroups | comp.lang.postscript |
| Subject | Re: What is the best way to work with a dictionary |
| Organization | Decebal Computing |
| References | <87zjtqdxrl.fsf@Aspire.decebal.nl> <b4drrlFju4mU1@mid.individual.net> |
| X-Homepage | http://www.decebal.nl/ |
| Date | Sat, 13 Jul 2013 23:25:03 +0200 |
| Message-ID | <87vc4edufk.fsf@Aspire.decebal.nl> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
| Cancel-Lock | sha1:SyxvzWMHMQGVrm1F7l/RRXrYSko= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 91 |
| NNTP-Posting-Host | 77.171.42.144 |
| X-Trace | 1373751173 news.kpn.nl 26325 77.171.42.144@kpn/77.171.42.144:34373 |
| Xref | csiph.com comp.lang.postscript:1425 |
Show key headers only | View raw
Op zaterdag 13 jul 2013 22:32 CEST schreef Helge Blischke:
> Cecil Westerhof wrote:
>
>> Until now I wrote functions like:
>> /ellipse { % x y unitX unitY colour
>> 5 dict begin
>> /colour exch def
>> /unitY exch def
>> /unitX exch def
>> /y exch def
>> /x exch def
>>
>> gsave
>> newpath
>> colour setrgbcolor
>> x y translate
>> unitX unitY scale
>> 1 1 1 0 360 arc closepath fill
>> stroke
>> grestore
>> end
>> } def
>>
>> I just saw in ‘PostScript Drawing: An Economist's Guide’ that it
>> also should be possible to do it in the following way: /ellipse { %
>> x y unitX unitY colour << /colour exch
> % operand stack at this point:
> % x y unitX unitY color /color mark
>> def
>> /unitY exch def
>> /unitX exch def
>> /y exch def
>> /x exch def
>>>> begin
>> gsave
>> newpath
>> colour setrgbcolor
>> x y translate
>> unitX unitY scale
>> 1 1 1 0 360 arc closepath fill
>> stroke
>> grestore
>> end
>> } def
>>
>> Which of the two is the better one and why? I think I like the
>> second one more. The only problem is that it does not work. I get:
>> Error: /unmatchedmark in -->>--
>>
>> I am using:
>> GPL Ghostscript 9.06
>>
>
> You see that the name /color gets associated with the object mark,
> i. e. the --<<--, which is equivalent to --mark--, gets consumed and
> therefore is missing at the time -->>-- is executed.
>
> Think about it.
>
> Helge
I had been looking a little further. The << … >> combination is used
when assigning constants. I could use a roll, but my parameter list
does not always has the same length. So I will keep working in my old
way.
By the way: I read somewhere that the value before dict does not
matter. Is that true, or not?
A nice effect with this function: ;-)
0 .25 3 {
/count exch def
40 40 40 count mul add
40 40 4 count sub mul
{1 count 10 div sub 0 0}
ellipse
200 40 count mul add 40
40 4 count sub mul 40
{0 count 4 div add dup dup}
ellipse
} for
I like the grey better as the red.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-13 22:13 +0200
Re: What is the best way to work with a dictionary Helge Blischke <h.blischke@acm.org> - 2013-07-13 22:32 +0200
Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-13 23:25 +0200
Re: What is the best way to work with a dictionary luser- -droog <mijoryx@yahoo.com> - 2013-07-13 17:04 -0700
Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-14 15:11 +0200
Re: What is the best way to work with a dictionary luser- -droog <mijoryx@yahoo.com> - 2013-07-14 08:04 -0700
Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-14 20:04 +0200
Re: What is the best way to work with a dictionary Olle <olavi.sakari@gmail.com> - 2013-07-15 06:13 -0700
Re: What is the best way to work with a dictionary Olle <olavi.sakari@gmail.com> - 2013-07-15 06:27 -0700
csiph-web