DIRECTORY Terminal USING [ Virtual ], Rope USING [ ROPE ], Imager USING [ Context ], ThreeDBasics USING [ Context, RGB ]; ImageTwiddle: CEDAR DEFINITIONS ~ BEGIN Context: TYPE ~ ThreeDBasics.Context; RGB: TYPE ~ ThreeDBasics.RGB; SetNamedColor: PROC [imagerCtx: Imager.Context, color: Rope.ROPE]; SetRGBColor: PROC [imagerCtx: Imager.Context, clr: RGB]; Rotate8BitClrMap: PROC [vt: Terminal.Virtual, firstValue, lastValue, duration: NAT _ 0]; Show8BitClrMap: PROC [context: REF Context]; ShowMapOnLog: PUBLIC PROC [context: REF Context, vt: Terminal.Virtual]; LoadMultiRamps: PROC [vt: Terminal.Virtual, colors: LIST OF RGB]; ThresholdClrMap: PROC [vt: Terminal.Virtual, levels: NAT]; ThresholdImage: PROC [context: REF Context, levels: NAT]; AdjustValueRamp: PROC[context: REF Context, exponent: RGB]; AdjustSaturation: PROC[context: REF Context, percent: REAL]; LoadOldStd8BitClrMap: PUBLIC PROC [vt: Terminal.Virtual]; SetUpTerrainColors: PROC[vt: Terminal.Virtual]; DitherImage: PROC[dstContext, rgbContext: REF Context]; ScaleDownImage: PROC[dstContext, srcContext: REF Context, strtchFctr: REAL _ 1.0]; END. π ImageTwiddle.mesa Last Edited by: Crow, April 4, 1989 11:16:11 am PDT Types Colors Called to set color in imager contexts For far out cheap thrills with color map display color map values in top middle of screen Print color map on log for context load linear ramps between succesive colors in list, divide color map into roughly equal parts set color map to constant steps simulating restricted number of grey levels adjust pixel values over whole image to conform restricted number of grey levels adjust pixel values over whole image to conform to ramp bent by exponent adjust pixel values over whole image to change saturation of image For backward compatibility with old AIS files, may be obsolete Set up custom colormap for old terrain map images Image manipulation Dither a full-color image down to 8 bits using 6x6x6 cube color map Scale image down to size given by viewports, uses Bresenham scaler. StrtchFctr scales source pixel values to expand or compress dynamic range Κ headJ33defaultΟk J J J J%head2Jhead3ΠbiIunit %JΟbIaΟn )B "8P' 9XP* ,P2 GP# AP_ :PM 9PR ;PJ