home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / postscri / 6071 < prev    next >
Encoding:
Text File  |  1992-12-22  |  3.4 KB  |  89 lines

  1. Newsgroups: comp.lang.postscript
  2. Path: sparky!uunet!brunix!doorknob!jgm
  3. From: jgm@cs.brown.edu (Jonathan Monsarrat)
  4. Subject: Re: Break down drawing larger than pagesize ?
  5. In-Reply-To: bill@leeweyr.sccsi.com's message of Tue, 22 Dec 1992 02:53:20 GMT
  6. Message-ID: <JGM.92Dec22092539@vegas.cs.brown.edu>
  7. Sender: news@cs.brown.edu
  8. Organization: Dept. of Computer Science, Brown University
  9. References: <BzIK8M.6yB@newsserver.technet.sg> <1h4rslINNl4f@CS.UTK.EDU>
  10.     <1992Dec21.171203.29295@cs.brown.edu>
  11.     <1992Dec22.025320.5909@leeweyr.sccsi.com>
  12. Date: Tue, 22 Dec 1992 14:25:39 GMT
  13. Lines: 74
  14.  
  15.  
  16.  
  17. > Has anybody been able to answer this question in general?
  18.  
  19. My answer would have been more general if I had used the "save"
  20. and "restore" operators, which can literally wipe all changes to 
  21. memory since the save.
  22.  
  23. Then it wouldn't matter whether your algorithm uses tons of memory.
  24. This should work on arbitrary pieces of code. Really!
  25.  
  26. OOPS: My last posted code assumed that you had 11x17 inch paper. 
  27.       At the top of this is a hack to let you set 11x17 if you have it.
  28.  
  29. -Jon
  30.  
  31. % example-multipage.ps 
  32. % PostScript Quickie by Jon Monsarrat 1992 jgm@cs.brown.edu
  33. %%%%%%%%%%%  Use the below code to get 11"x17" paper %%%%%%%%%%%%%
  34. %/Pwid 792 def         % page width
  35. %/Pht 1224 def         % page height
  36. %/Margin 23 def                % border margin
  37. %/Clw 15 def           % max-traffic line width
  38. %Pht 792 gt
  39. %    {statusdict /11x17tray known {
  40. %      statusdict begin 11x17tray end
  41. %    }{
  42. %      statusdict /setpageparams known {
  43. %          11 72 mul 17 72 mul 36 1    % w h offs. orientation
  44. %          statusdict begin setpageparams end
  45. %      }{
  46. %          11 17 div dup scale         % for laserwriter
  47. %      } ifelse
  48. %    } ifelse
  49. %  } if
  50.  
  51. %%%%%%%%%%%%%%%%%% definition of drawit (can be anything) %%%%%%%%%%%%%%%
  52.  
  53. /drawit    % ignore the complexity of this image. It can be anything.
  54. {
  55.  
  56. (LcHdBidZi_hdQ6[PaVa1b4c6F"J4b/>$O<)(di_zk{:UFfUg;ABF)(2n>]Eh:u?<)(P"M#R\(:$T<)
  57. ([gXfSZ]f\\dZbeZeb^fH;`?dR=ZS7)(K P!U!: H<)(9l9cCf:o?$)(7W4]6`:X;=)(U"W#_%:"R-)
  58. (A 5"<&Y%K"F"M,M,S\)i3e.M5F_PZR9>lP-)(wBxEuEs7x;uBq:q<q>hFh7o:=Nj<)(Z#]#b#:$R-)
  59. (m+m+k3S!R+d,;"^<)(GFP\\RamZf;TAP{X{fd<{C7)(4840N2:6N=)([ Z#^&:!c<)(<%?$C$:#8<)
  60. (D!J"L#:!B<)/a{def}def/M{exch}a/S{repeat}a/Q{{40 add}if}a 18{{}forall/R M a/x 2
  61. /y 3/z 5 3{R M mod 1 eq a}S x Q M y Q moveto 57 sub{3{y Q M x Q M 6 2 roll}S
  62. curveto}S z{fill}{stroke}ifelse}S showpage    % include the showpage!
  63.  
  64. } bind def
  65.  
  66. %%%%%%%%%%% Here's some more versatile code %%%%%%%%%%%%
  67.  
  68. /inch {72 mul} def
  69. /size 6 def     % How much to scale the picture?
  70. % This defines the size of the poster. The output will be scaled to
  71. % approximately (size+1)^2 number of pages for a page-sized image,
  72. % so be wary of printing this out too big. It take a long time.
  73.  
  74. /virtualh 2.5 def     % The unscaled snoopy fits on an 2.5" height
  75. /virtualw 2.2 def     % The unscaled snoopy fits on an 2.2" width
  76. /actualh 11 def       % The physical pages being printed on are 11" height
  77. /actualw 8.5 def      % The physical pages being printed on are 8.5" width
  78.  
  79. 0 1 size virtualh actualh div mul { /height exch def
  80.         0 1 size virtualw actualw div mul { /width exch def
  81.                    save        % Take a snapshot of memory state
  82.                        -1 actualw mul .5 add inch width mul
  83.                        -1 actualh mul .5 add inch height mul translate
  84.                        size size scale
  85.                        drawit
  86.                    restore     % completely restore the memory
  87.               } for
  88.       } for
  89.