🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #115

Re: halftoning spot function

#115
From: Dick Dunn
Date: Tue, 03 Nov 1992 00:52
41 lines
2718 bytes
fishboy@gandalf.UMCS.Maine.EDU (Jon Everett) asks about the spot function:
>...the function is supposed to take
>x,y coordinates of a pixel in the halftone cellbox as arguments.
>To me this is counter-intuitive. I would expect it to take a
>gray value as input and return the bitmap of the cellbox.

That would turn out to be a lot more work than the way it's done now, since
it would involve re-evaluating the spot function for each gray value that
occurs (and it would be more difficult to cache the result).

After you do a setscreen, the interpreter makes a bunch of calls to the
spot function, one call for each pixel position in the new halftone cell.
(The evaluation is lazy...it doesn't actually do this until the first time
it needs a halftone dot with the new spot function.)  Based on the screen
frequency and angle, the interpreter figures out the size of the halftone
"cell" (the pixels which will make up the halftone dot), and it calls the
spot function once for each pixel.  The spot function returns a value
which indicates where that pixel falls in the overall sequence of "turning
on" pixels as you go from white to black.

In effect, the interpreter builds an array of pixel coordinates paired with
spot-function values; then it sorts the array by spot-function value. 
This one array gives it the information to build a halftone dot of any
gray level.  Given a gray level which requires, say, k pixels turned on
out of n pixels in a halftone cell, the interpreter takes the first k
pixel locations out of its array of n and turns them on.

>...I would like to be able to explicitly
>define the order in which the pixels in a cellbox of a given
>size are turned on.

You can do this.  You've got a brief dance to get from the spot-function
arguments (which are in (-1,1)) to pixel locations in whatever counting
system you want to use...but after that, you can just return values which
correspond to the pixel's position in the sequence.  For example, if the
halftone cell has n pixels and the spot function wants to indicate that a
particular pixel should be at position i in the sequence, it should return
i/n (that is, "i n div").
-- 
Dick Dunn    rcd@raven.eklektix.com   -or-   raven!rcd    Boulder, Colorado
	...Simpler is better.
Technical Details
Message-ID: <1992Nov3.005214@eklektix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!hri.com!spool.mu.edu!caen!saimiri.primate.wisc.edu!ames!purdue!yuma!csn!raven!rcd
References: <1992Nov1.212253.16619@gandalf.UMCS.Maine.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!hri.com!spool.mu.edu!caen!saimiri.primate.wisc.edu!ames!purdue!yuma!csn!raven!rcd
From: rcd@raven.eklektix.com (Dick Dunn)
Newsgroups: comp.lang.postscript
Subject: Re: halftoning spot function
Message-ID: <1992Nov3.005214@eklektix.com>
Date: 3 Nov 92 00:52:14 GMT
References: <1992Nov1.212253.16619@gandalf.UMCS.Maine.EDU>
Organization: eklektix - Boulder, Colorado
Lines: 41