Ordered Dither Screen Creation Tool. Copyright 2010-2021 Artifex Software, Inc.

This code is designed to enable the creation of clustered dot threshold arrays
for halftoning, which can provide high lpi without quantization issues.  As
the lpi requirements of a halftone screen increases and begins to approach the
limits of the printer resolution, the size of the clustered dot decreases and
the number of levels that can be represented by the clustered dot decreases. 
To overcome this, the clustered dots are placed in a larger threshold array,
where the threshold values of the individual clustered dots scaled are
dithered to enable the representation of more gray levels within the larger
screen.  The dithering is performed in a manner that is pleasing to the visual
system.

The command line and parameters are as follows:

gen_ordered [-a target_angle] -d [dot_shape] -f [ps | ppm | raw | raw16 | tos]
    [-l target_lpi] [-q target_quantization_levels] [-r resolution]
    [-s size_of_supercell] 

where:

target_angle: The desired screen angle in degrees. [default 0 degrees]

dot_shape: The index number of the dot shape, CIRCLE, REDBOOK_CIRCLE, INVERTED,
    RHOMBOID, LINE_X, LINE_Y, DIAMOND1, DIAMOND2 or ROUNDSPOT values from 0 to 8,
    respectively.

target_lpi: The desired resolution of the screen in lines/inch. [default 300dpi]

target_quantization_levels:  indicates the desired number of "gray" levels
    that you wish to achieve with the screen (e.g. 256). [default 256]
    Special note on this option.  To achieve a particular quantization
    level, it is neccessary that the size_of_supercell is sufficiently large.
    Since the default size of size_of_supercell is set to 1, the minimum
    possible size is always used and the target quantization may not be 
    achieved.  A warning is displayed to indicate this condition and a minimum
    size is suggested.

resolution: The resolution of the output device in dots/inch. Horizontal and
    vertical resolution can be different if given as -rHxV where H is the
    horizontal, and V is the vertical resolution.  [default 300dpi]

size_of_supercell: The specified size of the supercell will impact the number
    of achievable levels.  If a small size is specified (example 1) the
    smallest periodic cell will be created, regardless of the setting for
    target_quantization_levels and it is possible that target_quantization_levels
    will not be achieved.  size_of_supercell should be set to something
    reasonably large to achieve a specified target_quantization_levels, for
    example 64.  Work is underway to have this value optimally set based upon
    the desired number of gray levels.

The output format (-f format) [default: tos] can be one of:

Portable Pixmap (ppm): The screen is stored in a .ppm image that is readily
    viewed by most image viewers. A maximum of 256 levels can be written in the
    format.  

PostScript (ps): The output will be a screen that can readily be brought into
    ghostscript.  For example:

    gswin32c -r300 -dDisplayFormat=16#20102 -c \
        "(Screen_20x10.ps) run sethalftone" examples/tiger.eps

    This will be a HalftoneType 3, 8-bit threshold array unless there are more
    than 256 levels. For up to 65,536 levels a HalftoneType 16 Postscript
    threshold array will be output.

Raw (raw): An 8 bit row ordered Width x Height threshold array that is
    periodic vertically and horizontally.  The size of the array is indicated in
    the output file name, for example Screen_Dithered_WxH.raw. A maximum of 256
    levels can be written in this format.  

16-bitRaw (raw16): An 16 bit row ordered Width x Height threshold array that
    is periodic vertically and horizontally.  The size of the array is indicated
    in the output file name, for example Screen_Dithered_WxH.16.raw. A maximum of
    65536 levels can be written in this format.  

Turn-On-Sequence (tos): A format compatible with the 'thresh_remap' program.
    This consists of a line with the Width and Height of the threshold array as
    "# W=%d H=%d\n" followed by (width * height) x, y pairs in the format "%d\t%d
    n". This format can support more than 65,536 levels, and is the default format.

Currently the code is limited in a few features, which will be included in the
near future:

1) The code currently only creates bi-level threshold arrays.  It is planned
   to enable the creation of multi-level threshold arrays.  Due to the manner
   in which the screens are created, this should be a simple task.

2) Often it is desired to incorporate a tone reproduction curve (TRC) into the
   design of a screen.  While not currently supported, the plan is add that
   option into this code. The thresh_remap program can be used to incorporate
   a TRC from the 'tos' format.

3) Typically screens are designed off line and provided as a threshold array
   to most applications.  In postscript, it is possible that screens can be
   specified within the document with specific attributes including line
   frequency and dot shape.  This code needs significant optimization before
   it should be folded into the ghostscript code base for use in this manner.

4) Minimum dot size handling is also a feature to be added.

