Icons.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Edited by McGregor on August 16, 1982 11:19 am
Last Edited by: Maxwell, December 17, 1982 9:57 am
Bier, December 15, 1988 5:46:40 pm PST
Doug Wyatt, January 19, 1987 10:27:32 pm PST
Pier, November 18, 1988 2:31:46 pm PST
Michael Plass, September 24, 1991 10:34 am PDT
DIRECTORY
Imager, Rope, ViewerClasses;
Icons: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
IconFlavor: TYPE ~ ViewerClasses.IconFlavor;
IconRef: TYPE ~ REF IconRep;
Halfword: TYPE ~ CARD16;
bitsPerHalfword: NAT ~ BITS[Halfword];
iconW: INT16 ~ 64;
iconH: INT16 ~ 64;
KAP for PCedar November 18, 1988
IconRep: TYPE ~ MACHINE DEPENDENT RECORD [
bits: PACKED ARRAY [0..iconH*iconW/bitsPerHalfword) OF Halfword, -- 64 x 64 bit pattern
label: BOOL ¬ FALSE, -- label icon with viewer name?
invertLabel: BOOL ¬ FALSE, -- label drawn with white bits if TRUE
filler: [0..37777B] ¬ 0, -- unused
lx, ly, lw, lh: INT16 ¬ 0, -- rectangle for label (from bottom left)
fillerInt: INT16 ¬ 0,
proc: DrawIconProc ¬ NIL -- proc to draw pattern
];
This record is MACHINE DEPENDENT so that it is compact and easy to copy from the IconFileFormat described below.
DrawIconProc: TYPE ~ PROC [flavor: IconFlavor, context: Imager.Context,
x, y: INTEGER ¬ 0, label: ROPE ¬ NIL];
DrawIcon: DrawIconProc;
Draw an icon in a context
NewIcon: PROC [info: IconRef] RETURNS [newFlavor: IconFlavor];
Create a new icon type
NewIconFromFile: PROC [file: ROPE, n: CARDINAL] RETURNS [newFlavor: IconFlavor];
Create a new icon type from the n'th icon read from the file
Icon File Format (for wizards/hackers). Icons must be packed into the file at two pages per icon, corresponding to a logical record type as follows:
IconFileFormat: TYPE ~ MACHINE DEPENDENT RECORD [
bits: PACKED ARRAY [0..iconH*iconW/bitsPerHalfword) OF Halfword ¬ ALL[0], -- 128 (32 bit words)
label: BOOL ¬ FALSE, -- 1 bit
invertLabel: BOOL ¬ FALSE, -- 1 bit
filler: [0..37777B] ¬ 0, -- leftovers, 14 bits
lx, ly, lw, lh: INT16 ¬ 0,
fillerInt: INT16 ¬ 0,
empty: PACKED ARRAY [0..250) OF Halfword ¬ ALL[0] -- leftovers
];
END.