cplai@daisy.UUCP (Chung-Pang Lai) (07/11/89)
I have written a PS program to experiment with the halftoning parameters. The program can be used as a framework for anyone who is interested to see various halftoning effects. Note: According to the red book, the screen setting is fine tuned for the printer by the manufacturor. Hence, setting your own screen may not get better results. Please read the comments to find out where you can change the screen parameter. ==== grays.ps ===== %!PS % This program illustrates the effects of the halftoning parameters % Change the frequency, grid angle and spot function if you like to % experiment with them 10 dict begin % set up local dictionary % define variables to draw the stripes /str 20 string def % tmp string holder /box { % - => - draw a 1x1" box of current gray 72 0 rlineto 0 72 rlineto -72 0 rlineto closepath fill } bind def /strip { % step => - overlap step # of box to form a strip /step exch def 0 setgray 0 -12 moveto step str cvs show ( steps) show 0 1 step { step div newpath dup 720 mul 0 moveto setgray box } for } bind def /page { % fctr => - draw a page with 5 strips, fctr = change factor of frequency /fctr exch def gsave currentscreen % get default setting % stack : freq angle spot-func % skip the next section to leave default spot function intact pop % remove spot function % replacement spot function, uncomments only one of the following % { pop pop 1} % random { exch pop abs 1 exch sub } % lines % { dup mul exch dup mul mul 1 exch sub } % crosses % { abs exch abs add 2 div } % diamonds % { mul } % Bowties % { dup dup mul mul exch dup dup mul mul add abs 1 exch sub } % lines & dots % { dup mul exch dup mul add 1 exch sub } % dots 3 1 roll % stack : spot-func freq angle % skip the next section to leave grid angle intact 2 mul 3 1 roll % stack : angle spot-func freq fctr div % divide it with change fctr dup /freq exch def % save a copy for display 3 1 roll % stack : freq angle spot-func setscreen 36 0 translate 0 50 moveto (frequency: ) show freq str cvs show 0 100 translate 10 strip % draw a strip with 10 overlapping boxes 0 100 translate 50 strip % draw a strip with 10 overlapping boxes 0 100 translate 100 strip 0 100 translate 200 strip 0 100 translate 300 strip showpage grestore } bind def % end of prolog /Times-Roman findfont 12 scalefont setfont 0 792 translate -90 rotate 1 1 6 { page } for % print page with change factor to frequency ranged from 1 to 6. end -- .signature under construction ... {pyramid, osu-cis, uunet, killer}!daisy!cplai C.P. Lai cplai%daisy.UUCP@uunet.UU.NET cplai%daisy@killer.DALLAS.TX.USA Daisy Systems Corp, 700B Middlefield Road, Mtn View CA 94039. (415)960-6961