gpxop.icn: Procedures for graphics operations

procedure LeftString:      draw left-justified string
procedure CenterString:    draw centered string
procedure RightString:     draw right-justified string
procedure ClearOutline:    draw and clear rectangle
procedure Translate:       add translation
procedure Sweep:           sweep area with mouse
procedure Zoom:            zoom image
procedure Capture:         capture image as string

link gpxop
May 26, 1999; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.

This file contains some graphics procedures.

LeftString(x, y, s)       draws a string left-aligned at (x, y).

CenterString(x, y, s)     draws a string centered at (x, y).

RightString(x, y, s)      draws a string right-aligned at (x, y).

ClearOutline(x, y, w, h)  draws a rectangle, erasing its interior.

Translate(dx, dy, w, h)   moves the window origin and optionally
                          sets the clipping region.

Zoom(x1, y1, w1, h1, x2, y2, w2, h2)
                          copies and distorts a rectangle.

Capture(p, x, y, w, h)    converts a window area to an image string.

Sweep()                   lets the user select a rectangular area.
____________________________________________________________

LeftString(x, y, s), CenterString(x, y, s), and RightString(x, y, s)
draw a string centered vertically about y and left-justified,
centered, or right-justified about x.

ClearOutline(x, y, w, h) draws a rectangle in the foreground color
and fills it with the background color.

Translate(dx, dy, w, h) adjusts a window's dx and dy attributes by
the values given.  Note that the resulting attribute values are the
sums of the existing values with the parameters, so that successive
translations accumulate.  If w and h are supplied, the clipping
region is set to a rectangle of size (w, h) at the new origin.

Zoom(x1, y1, w1, h1, x2, y2, w2, h2) is a distorting variation of
CopyArea that can be used to shrink or enlarge a rectangular area.
Zero, one, or two window arguments can be supplied.  Rectangle 1 is
copied to fill rectangle 2 using simple pixel sampling and replication.
The rectangles can overlap.  The usual defaults apply for both rectangles.

Sweep() lets the user select a rectangular area using the mouse.
Called when a mouse button is pressed, Sweep handles all subsequent
events until a mouse button is released.  As the mouse moves, a
reverse-mode outline rectangle indicates the selected area.  The
pixels underneath the rectangle outline are considered part of this
rectangle, implying a minimum width/height of 1, and the rectangle
is clipped to the window  boundary.  Sweep returns a list of four
integers [x,y,w,h] giving the rectangle bounds in canonical form
(w and h always positive).  Note that w and h give the width as
measured in FillRectangle terms (number of pixels included) rather
than DrawRectangle terms (coordinate difference).

Capture(palette, x, y, w, h) converts a window region into an
image string using the specified palette, and returns the string.

These procedures all accept an optional initial window argument.

Source code | Program Library Page | Icon Home Page