Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!decwrl!labrea!hanauma!steve
From: steve@hanauma.stanford.edu (Steve Cole)
Newsgroups: comp.lang.postscript
Subject: Re: Screening Procedures
Message-ID: <23038@labrea.Stanford.EDU>
Date: 11 Jul 88 18:41:34 GMT
References: 
Sender: news@labrea.Stanford.EDU
Reply-To: steve@hanauma.UUCP (Steve Cole)
Organization: Stanford University, Dept. of Geophysics
Lines: 42

I have also noticed that setscreen appears to limit your pattern to
a size of roughly 0.1 by 0.1 inches when you are trying to redefine the
halftone screen. I think I partly understand why. Maybe someone else
will know more.
 
In section 9.2 of the green book, on pattern fills, it says:
"Since the halftone screen is intended to be set once and forgotten,
much of the overhead is done when setscreen is invoked.
Even if only one gray level is needed, they may all be computed (by
calling the spot function as many times as necessary to build each
possible halftone cell)."
So PostScript wants to compute 256 (one for each gray level) copies of
your new halftone screen, one for each of the 256 possible gray levels.
This requires a lot of memory. For a 300 dot per inch printer, defining
a halftone screen that was one inch square would require 300x300x256
bits, or almost 3 megabytes. This is particularly annoying if you don't
want to do halftoning, but are using setscreen to do a pattern fill.
In that case only one of the 256 gray levels will ever be used. That is
why the green book doesn't advocate using setscreen for pattern fills.
 
I don't know why it seems to stop at around 0.1 inch square though, or
why in fact it stops at all. In section 4.8 of the red book, it says:
"In principle, the PostScript language permits defining screens with
arbitrarily large cells (i.,e. arbitrarily low frequencies). However,
cells that are very large (relative to the device resolution) or are at
unfavorable angles may exceed screen storage in some PostScript
configurations; if this occurs, setscreen executes a limitcheck error."
I have a feeling that PostScript is trying to avoid the limitcheck error
here by scaling down the requested halftone screen size. But I have never
found anything in the documentation that says it will do this.
 
I have done some work with different halftone patterns. I always do the
dithering myself and then print it in 1 bit/pixel mode rather than using
setscreen, partly because setscreen is difficult to use, and partly because
I want to be able to use a variety of output devices, and most don't have
any concept of halftoning. For anyone who's interested, some of my
halftoning code was distributed on the net in comp.sources.unix, as part
of a device-independent graphics package called "vplot".

--------------------------------------------------------------------------------
Steve Cole  (steve@hanauma.stanford.edu, decvax!hanauma!steve)
Department of Geophysics, Stanford University, Stanford, CA 94305