DIRECTORY Basics, Draw2d, Imager, ImagerColorMap, ImagerColorOperator, ImagerPixelArray, ImagerPixelMap, ImagerSample, InterminalBackdoor, Interpress, IO, Rope, Terminal; ColorTrixBasics: CEDAR DEFINITIONS IMPORTS Imager ~ BEGIN DeviceRectangle: TYPE ~ ImagerPixelMap.DeviceRectangle; PixelMap: TYPE ~ ImagerPixelMap.PixelMap; PixelMapMisc: TYPE ~ RECORD [ bpp: INTEGER, -- 8 or 24 bits per pixel bw, rg, b: PixelMap, -- black/white, red/green and blue 8 bit pixel maps x, y, w, h: INTEGER -- the window ]; VtMode: TYPE ~ {dither, gray, none}; CdType: TYPE ~ {gray, smooth, color}; PixelProc: TYPE ~ Draw2d.PixelProc; ValueProc: TYPE ~ PROC [x, y: INTEGER, data: REF ANY _ NIL] RETURNS [value: CARDINAL]; RGBProc: TYPE ~ PROC [x, y: INTEGER, data: REF ANY _ NIL] RETURNS [r, g, b: CARDINAL]; InsureColorDisplayOn: PUBLIC PROC [bpp: NAT]; GetColorDisplayPmMisc: PROC RETURNS [pmMisc: PixelMapMisc]; ShowPmMisc: PROC [pmMisc: PixelMapMisc]; GetColorDisplayPm: PROC RETURNS [pm: PixelMap]; ShowPm: PROC [pm: PixelMap]; FillPm: PROC [pm: PixelMap, color: CARDINAL]; PutPixel: PROC [pm: PixelMap, x, y: INTEGER, value: CARDINAL]; GetPixel: PROC [pm: PixelMap, x, y: INTEGER] RETURNS [value: CARDINAL]; PutBox: PROC [pm: PixelMap, x0, y0, x1, y1: INTEGER, value: CARDINAL]; PutLine: PROC [pm: PixelMap, x0, y0, x1, y1: INTEGER, value: CARDINAL]; PutScanLine: PROC [pm: PixelMap, y: INTEGER, proc: ValueProc, data: REF ANY _ NIL]; PutFrame: PROC [pm: PixelMap, proc: ValueProc, data: REF ANY _ NIL]; FillRGBPm: PROC [pmMisc: PixelMapMisc, r, g, b: CARDINAL]; PutRGBPixel: PROC [pmMisc: PixelMapMisc, x, y: INTEGER, r, g, b: CARDINAL]; GetRGBPixel: PROC [pmMisc: PixelMapMisc, x, y: INTEGER] RETURNS [r, g, b: CARDINAL]; PutRGBBox: PROC [pmMisc: PixelMapMisc, x0, x1, y0, y1: INTEGER, r, g, b: CARDINAL]; PutRGBLine: PROC [pmMisc: PixelMapMisc, x0, x1, y0, y1: INTEGER, r, g, b: CARDINAL]; PutRGBScanLine: PROC [ pmMisc: PixelMapMisc, y: INTEGER, proc: RGBProc, data: REF ANY _ NIL]; PutRGBFrame: PROC [pmMisc: PixelMapMisc, proc: RGBProc, data: REF ANY _ NIL]; SetPmMiscWindow: PROC [pm: PixelMapMisc, x, y, w, h: NAT] RETURNS [PixelMapMisc]; FillPmMisc: PROC [pm: PixelMapMisc, r, g, b: CARDINAL _ 0]; WindowFromPmMisc: PROC [pm: PixelMapMisc] RETURNS [DeviceRectangle]; CreatePmMisc: PROC [bpp: NAT, x, y, w, h: NAT] RETURNS [p: PixelMapMisc]; CopyPmMisc: PROC [src, dst: PixelMapMisc]; CopyClippedPmMisc: PROC [src, dst: PixelMapMisc, xSrc, ySrc, w, h: NAT]; InitCd: PROC [ type: CdType, pixelUnits: BOOL _ TRUE, clear: BOOL _ FALSE, cmapInit: BOOL _ TRUE] RETURNS [Imager.Context]; ClearCd: PROC [cd: Imager.Context, color: Imager.ConstantColor _ Imager.black]; ClearVt: PROC [vt: Terminal.Virtual _ NIL, val: INTEGER _ 0]; SetVtMode: PUBLIC PROC [vtMode: VtMode] RETURNS [Terminal.Virtual]; END. ŒColorTrixBasics.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, December 4, 1986 9:19:08 pm PST Generic Pixel Map Operations Insure that the color display is on with the given number of bits. Return the color display pixel maps, which depend on the mode of the color display. Transfer pixel map to color display for viewing; make color display mode and pmMisc agree. 8 Bit Pixel Map Operations Set the color display to 8 bit mode if necessary and return its pixel map. Transfer the pixel map to the color display for viewing. Fill the pixel map with color. Write to (x, y) the 8 bit value. Read from (x, y) the 8 bit value. Fill the box with the r, g, b values. Draw a one pixel wide line from (x0, y0) to (x1, y1). Write scanline-y to the 8 bit color display; buffers the line to improve efficiency. Write entire frame to the 8 bit color display; buffers each line to improve efficiency. This is approximately 3 times faster than calling PutPixel[] for each pixel. 24 Bit Pixel Map Operations Fill pmMisc with r, g, b; no-op if pmMisc is an 8 bit buffer. Write to (x, y) the 24 bit r, g, b value; no-op if pmMisc is an 8 bit buffer. Read from (x, y) the 24 bit r, g, b value; no-op if pmMisc is an 8 bit buffer. Fill the box with the r, g, b values. No-op if pmMisc is an 8 bit buffer. Draw a one pixel wide line from (x0, y0) to (x1, y1). No-op if pmMisc is an 8 bit buffer. Write scanline-y to the 24 bit color display; buffers the line to improve efficiency. No-op if pmMisc is an 8 bit buffer. Write entire frame to the 24 bit color display; buffers each line to improve efficiency. No-op if pmMisc is an 8 bit buffer. This is approximately 3 times faster than calling PutRGBPixel[] for each pixel. PixelMapMisc Operations Set the window of the appropriate pixel maps. Fill the appropriate pixel maps (if bw, fill bw with r value). Return the ImagerPixelMap style window. Create the appropriate pixel maps of the given size. Copy src to dst through the intersection of their window. Clip the src and translate it to the beginning of dst; the copied size is w by h. Imager Context Operations Clear context to specified color. Clear terminal to specified value. Miscellaneous Return color display virtual terminal. If mode is gray, then a gray display is created with 8pp. All 24bpp displays must be dither displays. The color display status is set and the color display turned on. Κν˜šœ™Jšœ Οmœ1™Jšœ ™ J™—š ‘œžœžœžœ žœ˜GJšœ!™!J™—š‘œžœ žœ žœ˜FJšœ%™%J™—š‘œžœ žœ žœ˜GJšœ5™5J™—š ‘ œžœžœžœžœžœ˜SJ™TJ™—š ‘œžœ'žœžœžœ˜DJ™WJ™L——™š‘ œžœ!žœ˜:Jšœ=™=J™—š‘ œžœžœ žœ˜KJšœM™MJ™—š ‘ œžœžœžœ žœ˜TJšœN™N—J˜š‘ œžœ(žœ žœ˜SJšœJ™JJ™—š‘ œžœ(žœ žœ˜TJšœZ™ZJ™—š‘œžœ˜Jš œžœžœžœžœ˜FJ™UJšœ#™#—J˜š ‘ œžœ-žœžœžœ˜MJ™XJšœ#™#J™O——™š‘œžœ žœžœ˜QJ™-J˜—š‘ œžœžœ˜;J™>J˜—š‘œžœžœ˜DJ™'J˜—š ‘ œžœžœžœžœ˜IJ™4J˜—š‘ œžœ˜*J™9J˜—š‘œžœ,žœ˜HJ™Q——™š‘œžœ˜Jš œžœžœ žœžœ žœžœ˜RJšžœ˜J˜—š‘œžœB˜OJšœ!™!J˜—š‘œžœžœžœ˜=Jšœ"™"——™ š‘ œžœžœžœ˜CJšœ\™\JšœZ™ZJšœ™J˜——Jšžœ˜—…— .§