🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #1512

Re: Advice sought: drawing boxes faster

#1512
From: Jan Michael Rynning
Date: Mon, 15 Jan 1990 14:21
47 lines
2405 bytes
In article <50851@bbn.COM> cosell@BBN.COM (Bernie Cosell) writes:
>[...]  My problem is that I need to draw a LOT of filled-in squares.
>like  >100,000 of 'em.  [...]  About the only thing I can't change
>is the order that the boxes are drawn --- that is determined as a
>by-product of another whole big bunch of processing [to *generate*
>what color each box should be].  [...]

I would use a large array (representing the drawing area) in the UNIX
program, to record the grey values for all the squares.  Then, after
I finished the grey value computations, I would send the grey values
for all the squares to the printer using the ``image'' operator.  If
95 grey values were enough, I would code them as ASCII characters to
save transmission time.  It takes less than two minutes to send that
data to the printer over a 9600 baud line.  Using AppleTalk, it took
24 seconds to print on our Apple LaserWriter II NTX.  Here's my test
program:

%!

/linestring 80 string def

systemdict /currentpacking known {currentpacking true setpacking} if
[
  32 255 div /sub cvx 255 94 div /mul cvx
  /dup cvx 0.0 /lt cvx
  [/pop cvx 0.0] cvx bind
  [/dup cvx 1.0 /gt cvx [/pop cvx 1.0] cvx bind /if cvx] cvx bind
  /ifelse cvx
  currenttransfer /exec cvx
]
cvx bind settransfer
systemdict /currentpacking known {setpacking} if

72 dup translate 6.5 72 mul dup scale

317 317 8 [317 0 0 317 0 0] {currentfile linestring readline pop} bind image
Here comes the data, coded as ASCII, with ASCII code 32=black, and 127=white.
You don't want to see more than 100,000 bytes of test data on the net, do you?

showpage

Jan Michael Rynning,			jmr@nada.kth.se
Department of Numerical Analysis	If you can't fully handle domains:
  and Computing Science,		ARPA: jmr%nada.kth.se@uunet.uu.net
Royal Institute of Technology,		UUCP: {uunet,mcvax,...}!nada.kth.se!jmr
S-100 44 Stockholm,			BITNET: jmr@sekth
Sweden.					Phone: +46-8-7906288
Technical Details
Message-ID: <2733@draken.nada.kth.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!draken!jmr
References: <50851@bbn.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!draken!jmr
From: jmr@nada.kth.se (Jan Michael Rynning)
Newsgroups: comp.lang.postscript
Subject: Re: Advice sought: drawing boxes faster
Message-ID: <2733@draken.nada.kth.se>
Date: 15 Jan 90 14:21:00 GMT
References: <50851@bbn.COM>
Reply-To: jmr@nada.kth.se (Jan Michael Rynning)
Organization: Royal Institute of Technology, Stockholm, Sweden
Lines: 47