[comp.lang.postscript] PostScript Toolset: More Comments, and Diag.ps

cramer@optilink.UUCP (Clayton Cramer) (08/30/89)

It's tempting to redefine "moveto" to "m" for reasons of size and
speed, but when distributing such tools, it's worthwhile to keep 
keywords completely undefined so that you can more easily follow 
the code, and so that you don't end up with a core of dozens or 
hundreds of defs (some interlocking) that you need to make the
tools work.  Think of these tools as prototyping tools -- you'll
probably merge them together and work on speed and size enhancements
once you have it all working.

%!
/Diag{ % draw diagonal line (start x, start y, angle, length, line gray, width)
      gsave 
      /Width exch def /Gray exch def 
      /Len exch def /Ang exch def /Y exch def /X exch def 
      newpath X Y moveto X Len Ang cos mul add 
      Y Len Ang sin mul add lineto Width setlinewidth Gray setgray stroke
      grestore} bind def
%%DEMO
0 0 60 700 0.60 1 Diag
100 100 45 500 0.40 12 Diag
0 0 30 200 0.1 4 Diag
showpage
-- 
Clayton E. Cramer {pyramid,pixar,tekbspa}!optilink!cramer
"No man is an island" is the beginning of the end of personal freedom.
----------------------------------------------------------------------------
Disclaimer?  You must be kidding!  No company would hold opinions like mine!