clipping.icn: Procedures for clipping lines

procedure DrawClipped:     draw line with clipping
procedure ClipLine:        clip line for DrawSegment
procedure Coalesce:        connect adjoining segments

link clipping
June 16, 2000; William S. Evans and Gregg M. Townsend
This file is in the public domain.

ClipLine(W, L, x, y, w, h) clips the multisegment line specified
by coordinates in L to the region (x, y, w, h), which defaults
to the clipping region of the window W.  ClipLine() returns a
list of coordinates suitable for calling DrawSegment().  If no
segments remain after clipping, ClipLine() fails.

Coalesce(L) connects adjoining segments from a DrawSegment()
argument list such as is produced by ClipLine().  Coalesce()
returns a list of DrawLine() lists.

DrawClipped(W, x1, y1, x2, y2, ...) draws a line using ClipLine()
with the clipping region of the window W.  DrawClipped() is
superior to DrawLine() only when lines with extremely large
coordinate values (beyond +/-32767) are involved.

Source code | Program Library Page | Icon Home Page