DIRECTORY ColorizeViewPoint, Profiles, Real, SymTab; ColorizeViewPointBackdoor: CEDAR DEFINITIONS IMPORTS Real ~ BEGIN OPEN ColorizeViewPoint; Colorization: TYPE ~ PROC [ip: ROPE, palette: Profiles.Profile, checkSystemSetting: CheckSystemSettingProc, mapData: MapData] RETURNS [newIP: ROPE]; InstallNewColorization: PROC [colorization: Colorization, setting: Setting]; RegisterKeywords: PROC [keywordsList: LIST OF ROPE]; ColorizeColorVP, ColorizeBasicGraphics, ColorizeProIllustrator, ColorizeText: Colorization; SubpaletteSearchList: PROC [prefixesIn: LIST OF ROPE, profile: Profiles.Profile] RETURNS [allPrefixes: LIST OF ROPE]; GetRecursiveValue: PROC [key: ROPE, palette: Profiles.Profile, subpaletteList: LIST OF ROPE, mapData: MapData, levelsAllowed: INT _ INT.FIRST, customOnly, noMappings: BOOL _ FALSE] RETURNS [value: LIST OF ROPE _ NIL, levelsExceeded: BOOL _ FALSE]; SetProfileBoolean: PROC [profile: Profiles.Profile, key: ROPE, val: BOOL]; MappingProc: TYPE ~ PROC [valueIn: LIST OF ROPE, name: ROPE, palette: Profiles.Profile, data: REF _ NIL] RETURNS [mapped: LIST OF ROPE]; --takes, eg, an RGB value and returns a gray value of 1.0-(.253r+.684g+.063b). By convention, MappingProcs guarantee that values enclosed in {} will not be touched. name & data are from ColorMappingRep ColorMapping: TYPE ~ REF ColorMappingRep; ColorMappingRep: TYPE ~ RECORD [name: ROPE, mappingProc: MappingProc, setTrue: LIST OF ROPE, data: REF _ NIL, bad: BOOL _ FALSE]; --setTrue: some mappings need to register their activity by setting palette entries, eg "IP2: TRUE" for the mapping to Black&White. data may be needed by MappingProc. If mapping ever found bad (as in a bad formula supplied by user), bad is set. MapData: TYPE ~ REF MapDataRep; MapDataRep: TYPE ~ RECORD [installedMappings, requestedMappings: LIST OF ColorMapping, exceptionsPalette: Profiles.Profile--holds exceptions to the mappings--]; GetMappings: PROC [palette: Profiles.Profile] RETURNS [mapData: MapData]; ApplyMappings: PROC [toMap: REF, palette: Profiles.Profile, mapData: MapData, mapOnly: ROPE _ NIL, subpaletteList: LIST OF ROPE _ NIL] RETURNS [mappedRope: ROPE _ NIL, mappedList: LIST OF ROPE _ NIL]; SampledColorIPFragments: TYPE ~ RECORD [ beforeTransform, afterTransform: ROPE _ NIL, sweepAngleMod360: [0..360) _ 0, --Determines the angle for the transformation removeDefiningObject: BOOL _ FALSE --Specifies whether to remove the object which spatially defines the sweep transformation ]; IPFragmentForColorSetting: PROC [def: LIST OF ROPE, palette: Profiles.Profile] RETURNS [frag: REF]; IPFragmentForColorDefinition: PROC [def: LIST OF ROPE, palette: Profiles.Profile] RETURNS [frag: REF]; IPRopeFromName: PROC [xeroxName: ROPE] RETURNS [header, ip: ROPE]; IPRopeFromRope: PROC [xeroxRope: ROPE] RETURNS [header, ip: ROPE]; CleanupUserCommands: PROC [commands: ROPE, palette: Profiles.Profile] RETURNS [cleanCommands: ROPE]; LineProcessor: TYPE ~ PROC [line, in: ROPE] RETURNS [newLine: ROPE _ NIL]; ProcessLinesMatching: PROC [pattern, in: ROPE, lineProcessor: LineProcessor] RETURNS [new: ROPE]; AltRound: PROC [x: REAL] RETURNS [INT] ~ INLINE {RETURN [IF x<0.0 THEN Real.Fix[x-.5] ELSE Real.Fix[x+.5]]}; END. ~ ColorizeViewPointBackdoor.mesa Copyright Σ 1989 by Xerox Corporation. All rights reserved. Eric Nickell, May 17, 1989 10:46:06 pm PDT Bob Coleman, September 6, 1990 12:47:05 pm PDT Registration Mechanisms colorization will be called to colorize masters allows Colorizations to register keywords (to aid correct parsing of colorizing cmds) Underlying Colorizations All of these colorize the interpress ROPE to another interpress ROPE according to the palette. Interacting With The Palette makes a correctly ordered, unduplicated list of prefixes, including the custom palette, Colorization-specific prefixesIn , document-wide prefixes listed in profile, and the "Default" Looks up key in palette. Continues to recurse with palette values until final values are reached. EG, palette entry "0%A: c13" will not return c13 but will look up c13 & return "1.0 .6 .2". subpaletteList gives the ordered list of subpalettes to check for values. If levelsAllowed is defaulted, it sets to a reasonable value. If exceeded, levelsExceeded gets TRUE. levelsAllowed=-1 will return the key, parsed into it's lookupVal (eg, C04 returns as C4). levelsAllowed=0 returns the palette value w/o further lookup. If customOnly, only looks in mapping and custom palettes. If nomappings, doesn't apply mappings to values found Allows limited access to changing the palette on the fly: the ability to change a boolean setting. Color Mapping Color mapping allows easy, temporary altering of colorization to get a b&w version for handouts, a saturated color version for overheads, a gray level version, etc. gets mappings specified by current document Can return either a ROPE or LIST OF ROPE. If mapOnly#NIL, just apply that single mapping Utilities Builds an interpress fragment from a list of tokens, e.g. as built by Profiles.ListOfToken. frag NARROWs to either a Rope.ROPE or a REF SampledColorIPFragments. xeroxName is a file name. xeroxRope is a ROPE containing the ip master, including header header is the Interpress header ip is (probably) a RopeFile of the chars in the master Neither header nor ip contain the delimiting space character IO.RIS[rope: Rope.Cat[header, " ", ip]] provides an IO.STREAM equivalent to an FS.StreamOpen on xeroxName cleans up the Custom Colors commands found both in the document CustomColorsPage and in the rope slices handed into ColorizeViewPoint.Do (like printer messages). The intent is to allow users wide latitude in their custom color commands, and then use CleanupUserCommands to transform them into well-defined command specs. finds lines in "in" that match pattern and hands each line (and "in") to lineProcessor. lineProcessor hands back a newLine if it changed it, otherwise NIL. This is a proc to get around the fact that DCedar and PCedar rounding is different wrt decimals at exactly .5. DCedar rounds up or down depending on odd or even; PCedar always rounds up. We will emulate PCedar. ΚΙ™™Icode™K™K™6K™