ColorizeViewPointGraphicsCommon.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Bob Coleman, May 2, 1990 3:24:36 pm PDT
Contains the common Graphics colorization code used by ColorizeColorVP, ColorizeBasicGraphics, and ColorizeProIllustrator
DIRECTORY
ColorizeViewPointBackdoor USING [MapData],
IPMaster USING [Op, SequenceType],
Profiles USING [Profile],
Rope USING [ROPE],
SymTab USING [Ref];
ColorizeViewPointGraphicsCommon: CEDAR DEFINITIONS
~ BEGIN
Op: TYPE ~ IPMaster.Op;
ROPE: TYPE ~ Rope.ROPE;
Seq: TYPE ~ IPMaster.SequenceType;
Common Graphics Colorization Stuff - used by Basic Graphics/Pro Illustrator/BitMapper
InvalidGfxKey: ERROR;
Color: TYPE ~ REF ColorRep;
ColorRep: TYPE ~ RECORD [value: ROPE, type: ATOM];
value: "green", "25%AC", ...
type: $CVPColorName, $BGPattern, $ProPattern, $OpaqGray, $TransGray...
SubsInfo: TYPE ~ REF SubsInfoRep;
SubsInfoRep: TYPE ~ RECORD [palette: Profiles.Profile, mapData: ColorizeViewPointBackdoor.MapData, subpaletteList: LIST OF ROPE, subs: SymTab.Ref--key: IP frag; value: it's associated Color--];
GetColorProc: TYPE ~ PROC [ip: ROPE, min, max: INT] RETURNS [newMin, newMax: INT, color, addendum: ROPENIL];
Given a piece of the ip, defines the boundaries of the color being replaced, and also an addendum to add after the replacement is made
ColorizeGraphics: PROC [ip: ROPE, subs: SubsInfo, opList: LIST OF Op, getColor: GetColorProc, seqList: LIST OF Seq ← NIL, customOnly: BOOLFALSE] RETURNS [colorizedIP: ROPENIL];
Given the SubsInfo, replaces the Interpress fragments defining BasicGraphics, ProIllustrator sampled blacks and ColorVP named colors with their correct ip fragment substitutions. opList & seqList give the ops to scan for. customOnly= use only custom palette for color defs
SeqAction: TYPE ~ PROC [key, makeSampledBlack: ROPE, real: REAL, textured, transparent: BOOL]; --a proc which installs the mapping of the makeSampledBlack Interpress fragment to its key
GfxTexture: TYPE ~ [0..12);
Pattern: TYPE ~ ARRAY [0..16) OF CARD16; --the pixel array used by makesampledblack to correctly render a given pattern
GfxTextureProc: TYPE ~ PROC [texture: GfxTexture] RETURNS [Pattern];
GfxGrayProc: TYPE ~ PROC [gray: REAL] RETURNS [Pattern];
GfxPaletteFromProfile: PROC [profile: Profiles.Profile, seqAction: SeqAction, gfxTexture: GfxTextureProc, gfxGray: GfxGrayProc, transparent, opaque: BOOLTRUE];
profile should contain the mapping from key name to color definition (e.g. "25%BDE: c7"). GfxPaletteFromProfile will use gfxTexture & gfxGray to create the interpress fragment specified by each pattern definition in the profile, and then use seqAction to install the mapping of that IPFrag to its pattern.
END.