DIRECTORY
ColorizeViewPointBackdoor USING [MapData],
IPMaster USING [Op, SequenceType],
Profiles USING [Profile],
Rope USING [ROPE],
SymTab USING [Ref];
~
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:
ROPE ←
NIL];
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:
BOOL ←
FALSE]
RETURNS [colorizedIP:
ROPE ←
NIL];
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:
BOOL ←
TRUE];
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.