putpixel.icn: Procedure to write quantized, processed pixel

procedure PixInit:         initialize pixel processing
procedure PutPixel:        write pixel

link putpixel
August 14, 1996; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.

These procedures assist pixel-by-pixel image construction.

PutPixel(W, x, y, k)    draws a single pixel after applying
                        dithering, color quantization, and
                        gamma correction.

PixInit(gamma, cquant, gquant, drandom)
                        initializes parameters for PutPixel().
____________________________________________________________

   PutPixel([win,] x, y, colr) sets the pixel at (x,y) to the given color
after applying dithering, color quantization, and gamma correction.
It is designed for constructing images a pixel at a time.  The window's
foreground color is left set to the adjusted color.

   Colr can be any value acceptable to Fg.  Mutable colors are not
dithered, quantized, or gamma-corrected.

   PixInit(gamma, cquant, gquant, drandom) may be called before PutPixel
to establish non-default parameters.  The default gamma value is 1.0
(that is, no correction beyond Icon's usual gamma correction).
cquant and gquant specify the number of color and grayscale quantization
steps; the defaults are 6 and 16 respectively.  If gquant + cquant ^ 3
exceeds 256 there is a potential for running out of colors.  drandom
is the fraction (0 to 1) of the dithering to be done randomly; the
default is zero.

Source code | Program Library Page | Icon Home Page