This procedure produces a dialog in which the user can change the most commonly used graphics attributes. Problems: If a text-entry field is not long enough to hold the current value for an attribute, the attribute has to be edited. Also, a slider is not the best way of changing the gamma attribute -- it's not possible to set a precise value. A slider was used mostly for demonstration purposes.
[ Full documentation | Source code ]
These procedures, when linked with an unsuspecting Icon program, cause psrecord (q.v) to begin recording PostScript commands when an X window is opened. This is done by overloading the built-in "open" function. The results of this may or may not be usable depending on how the original program is coded. Psrecord cannot emulate all the X calls and works best with programs designed for it. "stop" and "exit" are also overloaded to try and terminate the PostScript file properly. Other program exit paths, notably a return from the main procedure, are not caught.
[ Full documentation | Source code ]
These procedures draw barcharts that can grow dynamically. barchart(win, x, y, dx, dy, sf, n, l, w, b) creates a barchart. setbar(bc, n, v) sets the value of a bar. rebar(bc, sf) redraws a barchart with a new scaling factor.
[ Full documentation | Source code ]
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.
[ Full documentation | Source code ]
These procedures allow a window to be treated as a series of overlapping, independent layers, subject to some fairly severe restrictions. AlcPlane(W n) allocates planes. FrontPlane(W bp, color) moves a layer to the front. BackPlane(W bp, color) moves a layer to the back. PlaneOp(W bp, op) initializes layer operations. Deplane(W color) restores a window to normal.
[ Full documentation | Source code ]
These procedures implement pushbuttons using the "evmux" event multiplexor instead of the usual vidget library. button(win, label, proc, arg, x, y, w, h) establishes a pushbutton. buttonrow(win,x,y,w,h,dx,dy, label,proc,arg, label,proc,arg, ...) establishes a row of buttons. buttonlabel(handle, label) changes a button label.
[ Full documentation | Source code ]
cardbits() returns an image for use in drawing playing cards.
[ Full documentation | Source code ]
These procedures create an manipulate panels of cells. makepanel(n, m, size, fg, bg, pg) makes a panel in a hidden window with nxm cells of the given size, default 10. fg, bg, and pg are the colors for the window and panel backgrounds. fg and bg default to black and white, respectively. If pg is not given a patterned background is used. matrixpanel(matrix, size, fg, bg, pg) same as makepanel(), except matrix determines the dimensions. clearpanel(panel) restores the panel to its original state as made by makepanel. colorcell(panel, n, m, color) colors the cell (n,m) in panel with color. colorcells(panel, tier) is like colorcell(), except it operates on a tie-up record. cell(panel, x, y) returns Cell() record for the cell in which x,y lies. If fails if the point is out of bounds. tiercells(panel, matrix) is like colorcell(), except all cells are colored using a matrix of colors.
[ Full documentation | Source code ]
XCopy(window, x, y, w, h) copies an area of window to the clipboard. XCut(window, x, y, w, h) copies an area of window to the clipboard and erases it from window. XPaste(window, x, y) copies the clipboard to position x,y in window. NewClip(w, h) is a utility procedure that discards the old clipboard and creates a new one of the specified dimensions.
[ Full documentation | Source code ]
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.
[ Full documentation | Source code ]
This procedure generates all the color names in the Icon portable color naming system. Not all names produce unique colors.
[ Full documentation | Source code ]
These procedures convert between comma-separated Icon color specifications and a record with r, g, and b fields.
[ Full documentation | Source code ]
These procedures deal with colors in various ways. ScaleGamma(v, g) scales a number with gamma correction. Blend(k1, k2, ...) generates a sequence of colors. Contrast(win, k) returns "white" or "black" contrasting with k. Shade(win, k) sets Fg(), with dithering on a bilevel screen. RandomColor(W, p) returns a randomly chosen color from a palette. PaletteGrays(W, p) returns the gray entries of a palette. RGBKey(W, p, r, g, b) returns the palette key closest to (r,g,b). HSVKey(W, p, h, s, v) returns the palette key closest to (h/s/v). HSV(k) returns the h/s/v interpretation of a color. HSVValue(hsv) returns the ColorValue() of an h/s/v string. HLS(k) returns the h:l:s interpretation of a color. HLSValue(hls) returns the ColorValue() of an h:l:s string.
[ Full documentation | Source code ]
Note: This file contains procedures that can be linked by programs to add a visual interface, including programs that have one of their own. These procedures support the interactive creation and modification of color ways. ("Color way" is a the term used in the fashion industry for a list of colors used in coordination for fabric design or other decorative purposes. Think color scheme if you like.)
[ Full documentation | Source code ]
colrlist(f) returns a list of the colors given in a file. colrplte(p) returns a list of colors for the palette p.
[ Full documentation | Source code ]
These procedures convert between various color models. A color value is represented by a record (see the declarations below). Color values are normalized to a maximum of 1.0.
[ Full documentation | Source code ]
Requires: Version 9 graphics
[ Full documentation | Source code ]
[ Full documentation | Source code ]
These procedures provide a way to draw objects and then have them automatically redrawn (say, in a lighter color) n steps later. A user routine is called to do the actual drawing. If a second call to draw an object comes before its time has expired, the object's counter is reset and the drawing routine is not called. dpipe() initializes a decay pipeline and returns a pipeline object. decay() marks an object, unmarks another, and advances the clock.
[ Full documentation | Source code ]
This file contains several procedures for posting dialog boxes: AskDialog() -- TextDialog() with only caption and "No" instead of "Cancel" Notice(win, captions) -- notice dialog (a simple text dialog) TextDialog(win, captions, labels, defaults...) -- text dialog ToggleDialog(win, captions, labels, defaults...) -- toggle dialog SelectDialog(win, captions, labels, defaults...) -- selection dialog SaveDialog(win, caption, filename, len) -- save file dialog OpenDialog(win, caption, filename, len) -- open file dialog ColorDialog(win, captions, refcolor, callback, id) -- color dialog In all cases, the first or only caption is used as a dialog box ID, used to remember the dialog box location when it is closed. A later posting using the same ID places the new box at the same location.
[ Full documentation | Source code ]
distance(d1, d2, d3, ...) returns the distance between points in n-space distances d1, d2, d3, ... from the origin.
[ Full documentation | Source code ]
These procedures drag rectangular objects in a window. Drag(x, y, w, h) provides an opaque move. DragOutline(x, y, w, h) drags only the outline.
[ Full documentation | Source code ]
drawcard(win, x, y, c) draws the playing card labeled <c> with its upper left corner at (x,y). The card size is fixed at 80w x 124h. Card labelings are as follows. label: ABCDEFGHIJKLM NOPQRSTUVWXYZ abcdefghijklm nopqrstuvwxyz rank: A23456789TJQK A23456789TJQK A23456789TJQK A23456789TJQK suit: hearts....... spades....... clubs........ diamonds..... These differ unintentionally from the card mappings used in the "Mappings and Labelings" chapter of the Icon book (pp 243-244, 3/e). If the label is unrecognized, the back of a card is drawn. "-" is suggested as a conventional label for a card back.
[ Full documentation | Source code ]
This program displays the colors given in a list.
[ Full documentation | Source code ]
This procedure is a general-purpose interface used by various programs that draw figures of various kinds. Although it's listed as requiring graphics, that's really not necessary for interfaces to other devices or just producing coordinates.
[ Full documentation | Source code ]
dsetup(win, wlist) initializes a set of widgets according to a list of specifications created by the interface editor VIB. win can be an existing window, or null. wlist is a list of specifications; the first must be the Sizer and the last may be null. Each specification is itself a list consisting of a specification string, a callback routine, and an optional list of additional specifications. Specification strings vary by vidget type, but the general form is "ID:type:style:n:x,y,w,h:label". dsetup() returns a table of values from the dialog, indexed by ID.
[ Full documentation | Source code ]
These procedures manipulate Icon window events. Enqueue(W, eventcode, x, y, modkeys, interval) posts an event. pack_modkeys(s) encodes the modifier keys for an event. unpack_modkeys(n) decodes a modifier key value. pack_intrvl(n) encodes an event interval. unpack_intrvl(n) decodes an event interval.
[ Full documentation | Source code ]
Event(win) overloads the built-in function Event() and produces events using evplay().
[ Full documentation | Source code ]
These procedures implement a simple event handling package. This package has more recently been superseded by the vidget library. The event multiplexor is configured by registering *sensors*, which respond to events that occur when the mouse cursor is within a particular region. When a sensor fires, it calls a user procedure that was registered when the sensor was created. These routines interpret window events and invoke callbacks: sensor() registers the events of interest. evhandle() reads and responds to the next event. evmux() loops forever, handling events. Two other small procedures help build event-driven programs: quitsensor() registers a standardized response to Q or q. argless() is a "glue" procedure usable as a callback.
[ Full documentation | Source code ]
evplay(win) reads a window event history file (such as produced by evrecord()), and puts an event on the event queue for the given window. If the global identifier EventFile is nonnull, it is used as the event history; otherwise standard input is used.
[ Full documentation | Source code ]
This procedure writes a file of graphics events. The file can be converted to "pseudo events" by evplay.icn. When used with a vidget interface, evrecord can be passed as an argument to, say, GetEvents(), as in GetEvents(root, , evrecord)
[ Full documentation | Source code ]
This procedure fetches a pattern by number from a file of pattern specifications. It fails if the file does not exist or does not contain that many pattern specifications. The file is searched for in the current directory first, then using DPATH.
[ Full documentation | Source code ]
This procedure produces traces of fractal "stars". For a discussion of fractal stars, see Fractals; Endlessly Repeated Geometrical Figures, Hans Lauwerier, Princeton University Press, 1991, pp. 72-77. and Geometric and Artistic Graphics; Design Generation with Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 55-63. The arguments are: x, y, n, p, r, incr, extent x x coordinate of the initial point, default 0 y y coordinate of the initial point, default 0.5 n number of vertices, default 5 p number of phases, default 5 r reduction factor, default 0.35 incr angular increment factor, default 0.8 extent extent of drawing, 1.0 Chosing values for these arguments that produce interesting results and centering the star in the window is somewhat of an art. See fstartbl.icn for some good values.
[ Full documentation | Source code ]
This procedure produces a table of calls from which fractal stars can be produced.
[ Full documentation | Source code ]
This procedure effectively disables the graphics functions. Care should be taken in the way the disabled functions are used, since in their disabled forms, they return their first argument (if any).
[ Full documentation | Source code ]
These procedures support the interactive selection of colors.
[ Full documentation | Source code ]
This procedure returns the size of a GIF file in the form width,height. It fails if the file does not exist or is not a valid GIF file.
[ Full documentation | Source code ]
glabels(min, max, nticks) produces a list of aesthetically pleasing labels for graph ticks to cover a given range. It is based on the algorithm given by Paul S. Heckert in "Graphic Gems", Andrew S Glassner, ed., Academic Press, 1990.
[ Full documentation | Source code ]
Comments: This package is the collection of routines developed to facilitate traditional 2D graphics. It is incomplete, but still provides a reasonable amount of support. There is some support for 3D graphics here, but that is not so well developed. People are encouraged to improve these routines and add new routines. All routines use list-based subscripting. This allows programs to describe points as lists OR records. In the turtle graphics code, the use gives angles in degrees.
[ Full documentation | Source code ]
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).
[ Full documentation | Source code ]
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.
[ Full documentation | Source code ]
Links to core subset of graphics procedures.
[ Full documentation | Source code ]
These declarations are used in procedures that manipulate objects in two- and three-dimensional space.
[ Full documentation | Source code ]
As used here, the term "trace" refers to a sequence of points that generally consists of locations on a curve or other geometrical object. These procedures process such traces in various ways.
[ Full documentation | Source code ]
ifg() fails if (a) the running version of Icon does not support graphics, or (b) if it is, the graphics system is not running.
[ Full documentation | Source code ]
imagedim(s) returns a record that contains the type and dimensions of an image named s. The assumptions about image formats are naive.
[ Full documentation | Source code ]
These procedures provide help for applications that write sequences of images. seq_init(opts) initializes the naming parameters from the table opts. opts["n"] is the name, opts["f"] is the first number, and opts["c"] is the number of columns for the serial number. save_image(win, x, y, w, h) write the specified area of win using the next name in sequence. There is no check for duplicate names if the numbering wraps around.
[ Full documentation | Source code ]
This procedure produces a table of all the colors in a specified area of a window. The value corresponding to a color key is the number of pixels with that color
[ Full documentation | Source code ]
Procedures to manipulate image strings as records. imrcath(imr1, imr2) concatenates imr1 and imr2 horizontally imrcatv(imr1, imr2) concatenates imr1 and imr2 vertically imrcopy(imr) create copy of imr imrdraw(win, x, y, imr) draws an image record imrfliph(imr) flips an image record horizontally imrflipv(imr) flips an image record vertically imrnegative(imr) produces "negative" of image; intended for grayscale palettes imropen(imr) opens a hidden window with an image record imror(imr) forms inclusive "or" of two images imrpshift(imr, ir) shifts colors by mapping rotated palette imrrot180(imr) rotates an image record 180 degrees imrrot90cw(imr) rotates an image record 90 degrees clockwise imrshifth(imr, i) shifts an image record horizontally by i pixels with wrap-around; positive i to the right, negative to the left. imrshiftv(imr, i) shifts an image record vertically by i pixels with wrap-around; positive i to the top, negative to the bottom. imstoimr(s) converts an image string to an image record imrtoims(imr) converts an image record to an image string Note: All the procedures that produce image records modify their argument records; they do not return modified copies.
[ Full documentation | Source code ]
This procedure puts a bi-level image string in canonical form so that duplicates up to shifting can be eliminated. It is intended to be used in imlreduc.icn, which handles the rotational case. It presently only handles widths that are a multiple of four.
[ Full documentation | Source code ]
These procedures manipulate image strings. imswidth(im) returns the width of an image. imsheight(im) returns the height of an image. imspalette(im) returns the palette used by an image. imsmap(s1, s2, s3) applies map() to the image data. imswrite(f, s, n) writes an image string to a file. drawpalette(W, p, x, y, w, h, f, n) draws the color palette p. pickpalette(W, p, dx, dy, w, h, n) maps window coordinates to a palette drawn by drawpalette(). XPMImage(W, f, p) reads an XPM file, returning an image string.
[ Full documentation | Source code ]
This file contains procedures that manipulate string representations for images. patident(imx1, imx2) XDrawTile(win, xoff, yoff, pattern, magnif, mode) XDrawRows(win, xoff, yoff, imx, magnif, mode) bits2hex(s) decspec(pattern) getpatt(line) getpattnote(line) hex2bits(s) hexspec(pattern) legalpat(tile) legaltile(tile) pat2xbm(pattern, name) tilebits(imx) pdensity(pattern) pix2pat(window, x, y, cols, rows) readims(input) readimsline(input) rowbits(pattern) imstoimx(ims) imxtoims(imx) showbits(pattern) tiledim(pattern) pheight(pattern) pwidth(pattern) xbm2rows(input)
[ Full documentation | Source code ]
This file contains procedures that manipulate matrices that represent images.
[ Full documentation | Source code ]
edit_file(s) launches an editor, default vi, for the file named s. edit_list(L) provides edit dialog for the strings in the list L. error_notice(i, x, s) produces a notice dialog noting a run-time error. It can be used to handle procedure errors by runerr := error_notice. execute() provides a dialog for specifying a command. expose(win) attempt to make win the active window for the window manager. load_file(s, n) presents a standard open dialog with the caption s. and suggest name n. If the user specifies a file that can be opened, dialog_value is set to it. Otherwise, the dialog is presented again. The name of the selected button is returned. open_image(s) presents a standard open dialog with the caption s. If the user specifies a file that can be opened as an image in a window, the window is opened. Otherwise the dialog is presented again. ExitNotice(s[]) Notice() that exits. FailNotice(s[]) Notice() that fails. save_as(s, n) presents a standard save dialog with the caption s and suggested name n. If the user specifies a file that can be written, the file is assigned to dialog_value. Otherwise the dialog is presented again. save_as() fails if the user cancels. save_file(s, n) presents a standard save dialog with the caption s and suggested name n. If the user specifies a file that can be written, the file is returned. Otherwise, save_as() is called. The name of the selected button is returned. save_list(s, L) provides dialog for saving list items in a file. select_dialog(s, L, d) provides a dialog for selecting from a list of items. d is the default selection. snapshot(win, x, y, w, h, n) writes an image file for the specified portion of the window. The name for the file is requested from the user via a dialog box. If there already is a file by the specified name, the user is given the option of overwriting it or selecting another name. The procedure fails if the user cancels. n sets the width of the text-entry field. unsupported() provides Notice() for unsupported feature.
[ Full documentation | Source code ]
NOTE: The drawdown code is patched in from code in pfd2ill.icn and uses a different method than the others. One way or another, the methods should be made consonant.
[ Full documentation | Source code ]
NOTE: The drawdown code is patched in from code in pfd2ill.icn and uses a different method than the others. One way or another, the methods should be made consonant. This version is for ISDs without explicit thread-color information.
[ Full documentation | Source code ]
joinpair(points1, points2) draws lines between all pairs of points in the lists of points.
[ Full documentation | Source code ]
This procedure produces traces of jolygons. See Geometric and Artistic Graphics; Design Generation with Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 20-24. The arguments specify the starting positions, the extent of the drawing, the number of segments, the angle between consecutive segments, the ratio of the lengths of consecutive segments, a length factor, and a y scaling factor.
[ Full documentation | Source code ]
This procedure produces a table of L-systems.
[ Full documentation | Source code ]
This procedure draws strings of characters produced by L-systems.
[ Full documentation | Source code ]
These declarations are provided for representing Lindenmayer systems as records.
[ Full documentation | Source code ]
This procedure interpreters strings of characters produced by L-Systems and draws them using turtle graphics.
[ Full documentation | Source code ]
Comments: This package is the collection of routines developed to facilitate experiments with L-systems, including the interpretation of strings as turtle graphics commands. Only rudimentary L-systems are currently implemented. users are encouraged to extend this system.
[ Full documentation | Source code ]
These procedures implement a user interface for browsing a map that is drawn using a simple rectangular projection. The following interface actions are provided, if not overridden by the calling program: The arrow keys pan the display. Shifted arrows pan by a smaller amount. The + and - keys zoom in and out. The 0, 1, or HOME key resets the original display. The q key causes an immediate exit. Sweeping a region with the mouse zooms the display. Resizing the window causes it to be redrawn. The calling program provides the main loop and a drawing procedure; this module handles the interface and computes the output transformation. mapinit(win, proc, arg, xleft, xright, ytop, ybottom, m) initializes. mapgen(win, proc, arg) generates the map by invoking the callback. mapevent(win, e) handles a window event, possibly invoking a callback. mapproj(win) returns the projection used in the window. The win argument is optional in all procedures but can be used to supply the correct graphics context. The window argument is always supplied to the callback procedure.
[ Full documentation | Source code ]
mirror(win) mirrors win using p2mm symmetry and returns the result as a hidden window.
[ Full documentation | Source code ]
For a description of the method used here, see Geometric and Artistic Graphics; Design Generation with Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 90-95.
[ Full documentation | Source code ]
This package provides an interface for file navigation. It is intended for use with another application with a visual interface.
[ Full documentation | Source code ]
optwindow() opens a window, interpreting command options to set various window attributes.
[ Full documentation | Source code ]
These procedures produce traces of orbits. See Geometric and Artistic Graphics; Design Generation with Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 65-73. The arguments specify the starting positions, the extent of the drawing, the number of segments, and various parameters that control the orbit.
[ Full documentation | Source code ]
overlay(window, image) writes the image in the window, a line at a time.
[ Full documentation | Source code ]
These procedures implement programmer-defined palettes. They overload and build on top of the built-in palette mechanism.
[ Full documentation | Source code ]
Reads BLP or row file and produces pattern in row form.
[ Full documentation | Source code ]
This file contains procedures that manipulate graphic pattern representations. These procedures are intended for bi-level patterns representable by 0s and 1s. A row pattern is a list of strings, with each string representing a row in the pattern. DrawTile(win, xoff, yoff, pattern, magnif, mode) DrawRows(win, xoff, yoff, rows, magnif, mode) bits2hex(s) decspec(pattern) eqpats(prws, rows2) getpatt(line) getpattnote(line) hex2bits(s) hexspec(pattern) legalpat(tile) legaltile(tile) pat2xbm(pattern, name) tilebits(rows) pdensity(pattern) pix2pat(window, x, y, cols, rows) readpatt(input) readpattline(input) rowbits(pattern) pat2rows(pattern) rows2pat(rlist) showbits(pattern) tiledim(pattern) xbm2rows(input)
[ Full documentation | Source code ]
pborder(rows, l, r, t, b, c) pcaten(rows1, rows2, dir) pcenter(rows, w, h) pcrop(rows, l, r, t, b) pdisplay(rows) pdouble(rows, dir) pflip(rows, dir) phalve(rows, dir, choice) pinvert(rows) pminim(rows) por(rows1, rows2) protate(rows, dir) pscramble(rows, dir) pshift(rows, shift, dir) ptrim(rows, c)
[ Full documentation | Source code ]
pixelmap(name, p, args[]) reads the pixel list in file name and constructs an image, applying p ! args to each pixel. If p is omitted or null, the pixels are used as-is.
[ Full documentation | Source code ]
This procedure shows the "popularity" of colors in an image string.
[ Full documentation | Source code ]
These procedures intercept graphics calls in order to produce a PostScript copy of what is drawn. The record is decidedly imperfect.
[ Full documentation | Source code ]
These procedures assist pixel-by-pixel image construction. PutPixel(W, x, y, k) draws a single pixel after applying dithering, color quantization, and gamma correction. PixInit(gamma, cquant, gquant, drandom) initializes parameters for PutPixel().
[ Full documentation | Source code ]
These procedures generate randomly selected points with specified areas.
[ Full documentation | Source code ]
These procedures generate random geometrical figures.
[ Full documentation | Source code ]
These procedures write and read raw image files. The format of a raw image file is: width,height <palette entries with 2 hex digits, a blank, and a color specification> <blank line> <image data consisting of pairs of hext digits in row-primary order> These procedures are slow and should only be used when the image file formats that Icon can read and write are not sufficient.
[ Full documentation | Source code ]
This procedure produces repeats of an image specified number of times.
[ Full documentation | Source code ]
rgbsum(s1, s2) returns a color whose RGB components are the sums of the components for s1 and s2. rgbdif(s1, s2) returns a color whose RGB components are the differences of the components for s1 and s2. rgbavg(s1, s2) returns a color whose RGB components are the averages of the components for s1 and s2. rsgcomp(s) returns the color that is the complement of s. The results may not be what's expected in some cases.
[ Full documentation | Source code ]
This procedure produces a three-field RGB record from an Icon color specification. It fails id its argument is not a valid color specifi- cation.
[ Full documentation | Source code ]
Generate points for a regular polygon with the specified number of vertices and radius, centered at cx and cy. The offset angle is theta; default 0.
[ Full documentation | Source code ]
This procedure generates traces of regular stars.
[ Full documentation | Source code ]
This procedure produces a table of calls from which regular stars can be produced.
[ Full documentation | Source code ]
[ Full documentation | Source code ]
These procedures implement slider using the "evmux" event multiplexor instead of the usual vidget library. slider(win, proc, arg, x, y, w, h, lb, iv, ub) creates a slider. slidervalue(h, v) modifies a slider's value.
[ Full documentation | Source code ]
Draw spiral with n segments and t rotations, starting at (x,y). The extent determines the size of the drawing. The eccentricity is e (1 gives circle) and the reduction factor is r. The angular increment is incr and the y scaling factor is yfact.
[ Full documentation | Source code ]
spokes(x, y, radius1, radius2, n, m) draws spokes.
[ Full documentation | Source code ]
A stripchart models a continuous roll of paper that is marked along the right edge while it moves continuously to the left. This is also known as a chart recording. stripchart(window, x, y, width, height) creates a stripchart. sadvance(sc) advances a stripchart. smark(sc, y1, y2) marks a stripchart.
[ Full documentation | Source code ]
These procedures implement a simplified subset of the turtle.icn package. The main omissions are scaling, TWindow(), THome(), and high-level primitives like TCircle(). Some procedures accept fewer arguments, omit defaults, or omit the return value.
[ Full documentation | Source code ]
rand(x, y, extentx, extenty, n) generates random points in a rectangle. symrand(x, y, extentx, extenty, size, n) generates points symmetrically.
[ Full documentation | Source code ]
This package provides a variety of facilities for creating and editing binary arrays. It is intended for use with weaving tie-ups and liftplans.
[ Full documentation | Source code ]
imr2tie(imr) converts g2 image record to tie-ip pat2tie(pat) converts bi-level pattern to tie-up string pat2tier(pat) converts bi-level pattern to tie-up record showpat(pat, size, fg, bg) produces a hidden window for the pattern as a matrix with the specified foreground and background colors str2matrix(shafts, treadles, s) produce matrix from binary string testtie(s) succeeds if s is a valid tie-up but fails otherwise tie2imr(s) converts tie-up to g2 image record tie2pat(i, j, tie) converts tie-up to bi-level pattern tie2coltier(s) creates a black/white color tieup-record for tie-up s tie2tier(s) creates a 0/1 tie-up record for tie-up s tier2rstring(r) creates a tie-up string from a tie-up record twill(pattern, shift, shafts) twill tie-up overunder(pattern, treadles) over/under tie-up structure direct(shafts, treadles) direct tie-up satin(counter, shafts, treadles) satin tie-up tabby(shafts, treadles) tabby tie-up general(pattern, shift, rep, shafts) general tie-up exptie(expression, shafts, treadles) expression tie-up
[ Full documentation | Source code ]
This procedure tiles a portion of win1 over the specified portion of win2, doubling to reduce the number of copies required.
[ Full documentation | Source code ]
tileimg(win, image) tiles win with copies of image. tileims(win, ims) tiles win with copies of the image specified by ims Note that tileimg() uses the gamma value of win.
[ Full documentation | Source code ]
These procedures provide a "turtle graphics" interface to Icon. With this approach, popularized by the Logo programming language, all drawing is done by a "turtle" that carries a pen over a drawing surface under program control. TWindow(W) sets the turtle window. TDraw(n) moves forward and draws. TSkip(n) skips forward without drawing. TDrawto(x, y) draws to the point (x,y). TScale(n) sets or queries current scaling factor. TRight(d) turns right d degrees. TLeft(d) turns left d degrees. THeading(a) sets or queries the heading. TFace(x, y) sets or queries the heading. TX(x) sets or queries the current x position. TY(y) sets or queries the current y position. TGoto(x, y, a) sets the location and optionally changes the heading. THome() moves to the window center and turns to face upward. TReset() clears the window and reinitializes. TSave() saves the turtle state. TRestore() restores the turtle state. TRect(h, w) draws a rectangle centered at the turtle. TCircle(d) draws a circle centered at the turtle. TPoly(d, n) draws a polygon centered at the turtle. TFRect(h, w) draws a filled rectangle centered at the turtle. TFCircle(d) draws a filled circle centered at the turtle. TFPoly(d, n) draws a filled polygon centered at the turtle.
[ Full documentation | Source code ]
These procedures produce traces of twisting orbits. See Geometric and Artistic Graphics; Design Generation with Microcomputers, Jean-Paul Delahaye, Macmillan, 1987, pp. 73-80. The arguments specify the starting positions, the extent of the drawing, the number of segments, and various parameters that determine the orbits.
[ Full documentation | Source code ]
VSetFilter(vidget, value) sets the appropriate field in the structure for vidget to change the filtering mode (null for no filtering, "1" for filtering).
[ Full documentation | Source code ]
Links to basic vidget files needed to use the library.
[ Full documentation | Source code ]
vsetup(win, cbk, wlist[]) initializes a set of widgets according to a list of specifications created by the interface editor VIB. win can be an existing window, a list of command arguments to be passed to Window(), null, or omitted. In the latter three cases a new window is opened if &window is null. cbk is a default callback routine to be used when no callback is specified for a particular vidget. wlist is a list of specifications; the first must be the Sizer and the last may be null. Each specification is itself a list consisting of a specification string, a callback routine, and an optional list of additional specifications. Specification strings vary by vidget type, but the general form is "ID:type:style:n:x,y,w,h:label". vsetup returns a table of vidgets indexed by vidget ID. The root vidget is included with the ID of "root".
[ Full documentation | Source code ]
These are "helper" procedures to use in place of WAttrib(). This is a work in progress; at present it only handles fetching of a few attribute values.
[ Full documentation | Source code ]
This procedure produces a woven image from a pattern-form draft, which is passed to it as it's first argument. Window attributes may be passed as a list in the second argument
[ Full documentation | Source code ]
This procedure analyzes a Weaving Information File and returns xencoded ISD. Information in a WIF that is not necessary for an ISD is ignored. If there is a liftplan, the symbols in the treadling sequence correspond to shaft patterns given in the liftplan. The symbols for these pattern shafts are implicit and occur in orde to the number of shaft patterns. There is a problem where there is treadling with multiple treadles and no liftplan. *Presumably* that treadling can be used like a liftplan, but without, necessarily, a direct tie-up. This problem problem has not been addressed yet. If there is a liftplan, then a direct tie-up is implied by the wording in the WIF documentation. However, that's in the interpretation of the draft. The tie-up produced here is the one given in the WIF. If there is a liftplan and a treadling with multiple treadles, the treadling is ignored. This procedure does not attempt to detect or correct errors in WIFs, but it does try to work around some common problems.
[ Full documentation | Source code ]
These procedures are provided as quick-and-dirty ways to get a nominal window as, for example, when testing. win() causes error termination if a window can't be opened. winf(), on the other hand, just fails.
[ Full documentation | Source code ]
Window() opens a window with provisions for option processing and error handling. The returned window is assigned to &window if &window is null. If the window cannot be opened, the program is aborted. The characteristics of the window are set from several sources: Window's arguments, optionally including the program argument list; user defaults; and built-in defaults. These built-in defaults are the same as for optwindow(): bg=pale gray, fg=black, size=500,300.
[ Full documentation | Source code ]
This procedure writes an image file for a specified portion of a window. The name for the file is requested from the user via a dialog box. If there already is a file by the specified name, the user is given the option of overwriting it or selecting another name. The procedure fails if the user cancels.
[ Full documentation | Source code ]
wipe(window, color, direction, x, y, w, h) "wipes" a rectangular area of window to the specified color. The direction of wiping can be any one of: "right" from left to right "left" from right to left "down" from top to bottom "up from bottom to top "left-right" from left and right toward center "up-down" from top and bottom toward center "in" from outside to inside The default direction is "right". The default color is the background color of the window. x, y is the top left corner of the area and w and h are the width and height. An omitted value defaults to the one for the entire window.
[ Full documentation | Source code ]
These procedures provide window input and output using "W" names as substitutes for standard input and output functions. WOpen() opens and returns a window; the result is also assigned to &window if &window is null. WOpen(attrib, ...) opens and returns a window. WRead(W) reads a line from a window. WReads(W, i) reads i characters from a window. WWrite(W, s, ...) writes a line to window. WWrites(W, s, ...) writes a partial line to window. WDelay(W, n) flushes a window, then delays n milliseconds. default: n = 1 WClose(W) closes a window; if W === &window, sets &window to &null. WDone(), WQuit(), QuitCheck(), and QuitEvents() incorporate knowledge of the Icon standard set of "quit" events, currently the letters "q" or "Q". The procedures themselves are trivial. WQuit() consumes unread window events and succeeds if a quit event is seen. It does not wait. WDone() waits until a quit event is read, then exits the program. QuitCheck(ev) calls exit() if its parameter is a quit event; QuitCheck can be used with the vidget package as a default event handler. QuitEvents() generates the standard set of quit events. ZDone() is a zooming version of WDone(). If the window is resized while waiting for a quit event, its contents are zoomed to fill the new size. Zooming to a multiple of the original size can also be accomplished by typing a nonzero digit into the window. SubWindow(W, x, y, w, h) produces a subwindow by creating and reconfiguring a clone of the given window. The original window is not modified. In the clone, which is returned, clipping bounds are set by the given rectangle and the origin is set at the rectangle's upper left corner.
[ Full documentation | Source code ]
BestFont(W, s, ...) generates X-windows font names matching a given specification, beginning with the closest match. The ranking algorithm is similar to that used in Font() but it is not identical.
[ Full documentation | Source code ]
This file contains procedures that manipulate points representing vertices.
[ Full documentation | Source code ]
These procedures perform reflections, rotations, and concatenations of images. Warning: Some of these operations are slow.
[ Full documentation | Source code ]
As used here, the term "trace" refers to a sequence of points that generally consists of locations on a curve or other geometrical object.
[ Full documentation | Source code ]