mask_make
Description
mask_make (written by A. Y. and J. E. H. C., May 1990) rasterizes one or more closed polygons from an ASCII vertex file into an 8-bit OMG1 (JHC_header) mask image of arbitrary dimensions (-xlen, -ylen), filling polygon interiors with a specified Digital Number (-val).
CLI Options & Usage
mask_make -infile <vertex_file> -outfile <mask.8bit> \
[-xlen <cols>] [-ylen <rows>] [-val <0..255>] [-nmap <n>]
-infile <vertex_file>: Input ASCII file containing(x, y)vertex coordinates (999999 999999separates multiple polygons when-nmap > 1).-outfile <mask.8bit>: Output 8-bitOMG1(JHC_header) mask file.-xlen <cols> -ylen <rows>: Mask width and height in pixels (default:512 Ã 512).-val <0..255>: Fill value assigned to polygon interior and boundary pixels (default:128).-nmap <n>: Number of distinct polygons to read from<vertex_file>(default:1).
Algorithm
- Allocates an
xlen à ylenbyte buffer initialized to0. - For each of the
nmappolygons, connects consecutive vertices(x1, y1) -> (x2, y2)using integer line stepping (255for horizontal segments,254for non-horizontal edges, with double-crossing adjustment at local vertical extrema). - Performs a scanline parity fill across each row
j = 0 .. ylen-1, toggling inside/outside state at254edge markers and writingvalto all interior pixels before saving theOMG1file.