bevel.icn: Procedures for drawing beveled objects

procedure BevelReset:      set colors for beveled drawing
procedure BevelCircle:     draw beveled circle
procedure BevelDiamond:    draw beveled diamond
procedure BevelSquare:     draw beveled square
procedure RidgeRectangle:  draw ridged rectangle
procedure GrooveRectangle: draw grooved rectangle
procedure BevelRectangle:  draw beveled rectangle
procedure DrawRidge:       draw ridged line
procedure DrawGroove:      draw grooved line
procedure FillSquare:      draw filled square
procedure FillDiamond:     draw filled diamond
procedure FillTriangle:    draw filled triangle

link bevel
April 1, 1997; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.

These procedures draw objects having a raised or sunken appearance.

BevelReset(win)                         sets/resets shading colors.

BevelCircle(win, x, y, r, bw)           draws a beveled circle.

BevelDiamond(win, x, y, r, bw)          draws a beveled diamond.

BevelTriangle(win, x, y, r, o, bw)      draws a beveled triangle.

BevelSquare(win, x, y, r, bw)           draws a beveled square.

FillSquare(win, x, y, r)                fills a square.

FillDiamond(win, x, y, r)               fills a diamond.

FillTriangle(win, x, y, r, o)           fills a triangle.

RidgeRectangle(win, x, y, w, h, bw)     draws a ridged rectangle.

GrooveRectangle(win, x, y, w, h, bw)    draws a grooved rectangle.

BevelRectangle(win, x, y, w, h, bw)     draws a beveled rectangle.

DrawRidge(win, x1, y1, x2, y2, w)       draws a ridged line.

DrawGroove(win, x1, y1, x2, y2, w)      draws a grooved line.
____________________________________________________________

These procedures allow the drawing of buttons and other objects
with a three-dimensional appearance.  They are intended to be
used like other graphics primitives (DrawRectangle() etc.).
However, this abstraction fails if the background color changes
or if clipping is set, due to the use of cached graphics contexts.

BevelReset(win) -- set/reset colors for beveling
     This procedure is called automatically by the others.
     It can be called explicitly if the background color is changed.

BevelCircle(win, x, y, r, bw) -- draw beveled circle
BevelDiamond(win, x, y, r, bw) -- draw beveled diamond
BevelTriangle(win, x, y, r, o, bw) -- draw beveled triangle
BevelSquare(win, x, y, r, bw) -- draw beveled square
     These procedures draw a figure centered at (x,y) and having
     a "radius" of r.  bw is the bevel width, in pixels.
     o is the triangle orientation: "n", "s", "e", or "w".

FillSquare(win, x, y, r) -- fill square centered at (x,y)
FillDiamond(win, x, y, r) -- fill diamond centered at (x,y)
FillTriangle(win, x, y, r, o) -- fill triangle centered at (x,y)
     These procedures complement the beveled outline procedures
     by filling a figure centered at (x,y).  Fillcircle is already
     an Icon function and so is not included here.

RidgeRectangle(win, x, y, w, h, bw) -- draw ridged rectangle
GrooveRectangle(win, x, y, w, h, bw) -- draw grooved rectangle
BevelRectangle(win, x, y, w, h, bw) -- draw beveled rectangle
     These procedures draw a rectangle with the given external
     dimensions and border width.  Beveled rectangles are raised
     if bw > 0 or sunken if bw < 0.

DrawRidge(win, x1, y1, x2, y2, w) -- draw a ridged line
DrawGroove(win, x1, y1, x2, y2, w) -- draw a grooved line
     These procedures draw a groove or ridge of width 2 at any angle.
     If w = 0, a groove or ridge is erased to the background color.

For BevelSquare() and FillSquare(), the width drawn is 2 * r + 1,
not just 2 * r.  This is necessary to keep the visual center at the
specified (x, y) and is consistent with the other centered procedures
and the built-in function FillCircle.

Source code | Program Library Page | Icon Home Page