DIRECTORY CDColors, CDPrivate, CD; CDColorsImpl: CEDAR PROGRAM EXPORTS CDColors = BEGIN DisplayType: TYPE = CDColors.DisplayType; DisplayMode: TYPE = CDColors.DisplayMode; Brick: TYPE = CDColors.Brick; -- ARRAY [0..4) OF CARDINAL; ColorTable: TYPE = CDColors.ColorTable; ColorTableSet: TYPE = CDColors.ColorTableSet; ColorDefinition: TYPE = CDColors.ColorDefinition; globalColors: PUBLIC REF ColorDefinition _ NEW[ColorDefinition_ALL[NIL]]; emptyBrick: REF Brick = NEW[Brick_ALL[0]]; fullBrick: REF Brick = NEW[Brick_ALL[LAST[CARDINAL]]]; DefineColor: PUBLIC PROC[ lev: CD.Layer, brick: REF Brick _ NIL, -- do no more change the values display: DisplayType _ bw, mode: DisplayMode _ normal, table: REF ColorDefinition _ NIL --NIL uses the global table ] = BEGIN dTable: REF ColorTableSet; IF table=NIL THEN table _ globalColors; IF brick=NIL THEN brick _ fullBrick ELSE IF brick^=fullBrick^ THEN brick _ fullBrick -- reuse fullbrick; reduce swapping ELSE IF brick^=emptyBrick^ THEN brick _ emptyBrick; IF table[display]=NIL THEN { IF table=globalColors THEN { IF display=bit1 THEN display _ bw --color 1 bit/pixel gets same stipples as bw ELSE IF display=bit9 THEN display _ bit8; --9 bit/pixel uses same stipples as 8 bit/pixel }; IF table[display]=NIL THEN { table[display] _ NEW[ColorTableSet _ ALL[NIL]]; table[display][normal] _ NEW[ColorTable _ ALL[fullBrick]]; table[display][pushedOut] _ NEW[ColorTable _ ALL[fullBrick]]; }; }; dTable _ table[display]; dTable[mode][lev] _ brick; IF mode=normal THEN dTable[pushedOut][lev] _ brick; END; DefineColor[lev: 0, display: bw]; DefineColor[lev: 0, display: bit4]; DefineColor[lev: 0, display: bit8]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[257,0,0,0]], display: bw]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[257,0,0,0]], display: bw, mode: pushedOut]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[0,10,0,11*256]], display: bit4]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[0,10,0,11*256]], display: bit4, mode: pushedOut]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[0,1,256,0]], display: bit8]; DefineColor[lev: CD.backGround, brick: NEW[Brick_[0,1,256,0]], display: bit8, mode: pushedOut]; END. ¬CDColorsImpl.mesa (Viewer definitions for ChipNDale) Copyright c 1984 by Xerox Corporation. All rights reserved. by Christian Jacobi, September 19, 1984 6:00:17 pm PDT last edited by Christian Jacobi, June 5, 1985 12:20:19 pm PDT -- ChipNDale interface defining low layer color handling. -- (semi-public) -- {bw, bit1, bit2, bit4, bit8, bit9}; -- {normal, pushedOut}; -- ARRAY CD.Layer OF REF Brick; -- ARRAY DisplayMode OF REF ColorTable; -- ARRAY DisplayType OF REF ColorTableSet; --Defining a brick with mode normal also clears the pushedOut brick. --A NIL brick makes a reasonable default. --The procedure may exchange bricks if they have the same values. Ê?˜šœ;™;Jšœ Ïmœ1™™>J™—šÏk ˜ Jšœžœ˜J˜—Jšœ;™;Jšœ™šÏn œžœžœ˜Jšžœ ˜—Jšž˜J˜šœ žœ˜)Jšœ'™'—šœ žœ˜)Jšœ™—šœžœ˜JšÏc˜—šœ žœ˜'Jšœ ™ —šœžœ˜-Jšœ'™'—šœžœ˜1Jšœ*™*—J˜Jš œžœžœžœžœžœ˜KJšœ žœ žœžœ˜*Jš œ žœ žœžœžœžœ˜6J˜šŸ œžœžœ˜Jšœžœ˜Jšœžœ žœ ˜7Jšœ˜Jšœ˜Jšœžœžœ ˜=Jšœ˜JšœD™DJšœ)™)JšœA™AJšž˜Jšœžœ˜Jšžœžœžœ˜'Jšžœžœžœ˜#Jšžœžœžœ #˜TJšžœžœžœ˜3šžœžœžœ˜šžœžœ˜Jšžœžœ ,˜PJšžœžœžœ /˜ZJ˜—šžœžœžœ˜Jšœžœžœžœ˜/Jšœžœžœ ˜:Jšœžœžœ ˜=J˜—J˜—Jšœ˜Jšœ˜Jšžœ žœ ˜3Jšžœ˜—J˜Jšœ!˜!Jšœ#˜#Jšœ#˜#Jšœžœžœ"˜LJšœžœžœ3˜]Jšœžœžœ(˜RJšœžœžœ9˜cJšœžœžœ$˜NJšœžœžœ5˜_Jšžœ˜J˜J˜—…—œ‡