procedure Distance: distance between two points procedure InBounds: check point within rectangle procedure ScratchCanvas: return scratch canvas
link gpxlib
August 21, 1998; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.
This file contains a few eclectic graphics procedures. ScratchCanvas(w, h, id) creates a temporary, hidden window. PushWin(L) adds a default window to an argument list. Distance(x1, y1, x2, y2) computes the distance between two points. InBounds(x, y, w, h) succeeds if (&x,&y) is within (x,y,w,h). ____________________________________________________________ The following procedure allows an additional first argument specifying a window to use instead of &window: ScratchCanvas(w, h, id) returns a hidden-canvas window for temporary use. The same scratch window (per display) is returned by successive calls with the same ID, avoiding the cost of creation. The size is guaranteed to be at least (w, h), which default to the size of the window. The scratch window must not be closed by the caller, but an EraseArea can be done to reclaim any allocated colors. ____________________________________________________________ The following procedures do not accept a window argument: PushWin(L) pushes &window onto the front of list L if the first element of the list is not a window. This aids in constructing variable-argument procedures with an optional window argument. Distance(x1, y1, x2, y2) returns the distance between two points as a real number. InBounds(x, y, w, h) checks whether &x and &y are within the given region: it returns &null if x <= &x <= x+w and y <= &y <= y+h, and fails otherwise.