DIRECTORY ImagerColorDefs USING [Color], ImagerDevice USING [BoxProc, CharMask, Class, ClassRep, Device, DeviceBox, DeviceRep, HalftoneParameters, RunProc, Transformation], ImagerRaster USING [Ambusher]; ImagerRasterAmbushImpl: CEDAR PROGRAM EXPORTS ImagerRaster ~ BEGIN OPEN ImagerDevice; Ambusher: TYPE ~ ImagerRaster.Ambusher; MakeClass: PROC [old: Class] RETURNS [new: Class] ~ { new _ NEW[ClassRep _ [ type: $Ambush, SetColor: AmbushSetColor, SetPriority: AmbushSetPriority, SetHalftone: AmbushSetHalftone, MaskRuns: AmbushMaskRuns, MaskBoxes: AmbushMaskBoxes, MaskBits: AmbushMaskBits, DrawBits: AmbushDrawBits, MoveBoxes: AmbushMoveBoxes, MaskChar: AmbushMaskChar ]]; IF old.SetColor = NIL THEN new.SetColor _ NIL; IF old.SetPriority = NIL THEN new.SetPriority _ NIL; IF old.SetHalftone = NIL THEN new.SetHalftone _ NIL; IF old.MaskRuns = NIL THEN new.MaskRuns _ NIL; IF old.MaskBoxes = NIL THEN new.MaskBoxes _ NIL; IF old.MaskBits = NIL THEN new.MaskBits _ NIL; IF old.DrawBits = NIL THEN new.DrawBits _ NIL; IF old.MoveBoxes = NIL THEN new.MoveBoxes _ NIL; IF old.MaskChar = NIL THEN new.MaskChar _ NIL; }; AmbushDevice: PUBLIC PROC [ambusher: Ambusher] RETURNS [Device] ~ { RETURN[NEW[ImagerDevice.DeviceRep _ [class: MakeClass[ambusher.device.class], box: ambusher.device.box, surfaceToDevice: ambusher.device.surfaceToDevice, surfaceUnitsPerInch: ambusher.device.surfaceUnitsPerInch, surfaceUnitsPerPixel: ambusher.device.surfaceUnitsPerPixel, data: ambusher]]]; }; AmbushSetColor: PROC[device: Device, color: ImagerColorDefs.Color, viewToDevice: Transformation] ~ { data: Ambusher ~ NARROW[device.data]; data.device.class.SetColor[data.device, color, viewToDevice]; }; AmbushSetPriority: PROC[device: Device, priorityImportant: BOOL] ~ { data: Ambusher ~ NARROW[device.data]; data.device.class.SetPriority[data.device, priorityImportant]; }; AmbushSetHalftone: PROC[device: Device, halftone: HalftoneParameters] ~ { data: Ambusher ~ NARROW[device.data]; data.device.class.SetHalftone[data.device, halftone]; }; AmbushMaskRuns: PROC[device: Device, bounds: DeviceBox, runs: PROC[RunProc]] ~ { data: Ambusher ~ NARROW[device.data]; action: PROC ~ {data.device.class.MaskRuns[data.device, bounds, runs]}; data.maskProc[data, bounds, action]; }; AmbushMaskBoxes: PROC[device: Device, bounds: DeviceBox, boxes: PROC[BoxProc]] ~ { data: Ambusher ~ NARROW[device.data]; action: PROC ~ {data.device.class.MaskBoxes[data.device, bounds, boxes]}; data.maskProc[data, bounds, action]; }; AmbushMaskBits: PROC[device: Device, srcBase: LONG POINTER, srcWordsPerLine: NAT, ts, tf: INTEGER, boxes: PROC[BoxProc]] ~ { data: Ambusher ~ NARROW[device.data]; bb: DeviceBox _ [smin: CARDINAL.LAST, fmin: CARDINAL.LAST, smax: 0, fmax: 0]; bbBox: PROC [b: DeviceBox] ~ { IF b.smin < bb.smin THEN bb.smin _ b.smin; IF b.fmin < bb.fmin THEN bb.fmin _ b.fmin; IF b.smax > bb.smax THEN bb.smax _ b.smax; IF b.fmax > bb.fmax THEN bb.fmax _ b.fmax; }; action: PROC ~ {data.device.class.MaskBits[data.device, srcBase, srcWordsPerLine, ts, tf, boxes]}; boxes[bbBox]; IF bb.smin < bb.smax THEN data.maskProc[data, bb, action]; }; AmbushDrawBits: PROC[device: Device, srcBase: LONG POINTER, srcWordsPerLine: NAT, ts, tf: INTEGER, boxes: PROC[BoxProc]] ~ { data: Ambusher ~ NARROW[device.data]; bb: DeviceBox _ [smin: CARDINAL.LAST, fmin: CARDINAL.LAST, smax: 0, fmax: 0]; bbBox: PROC [b: DeviceBox] ~ { IF b.smin < bb.smin THEN bb.smin _ b.smin; IF b.fmin < bb.fmin THEN bb.fmin _ b.fmin; IF b.smax > bb.smax THEN bb.smax _ b.smax; IF b.fmax > bb.fmax THEN bb.fmax _ b.fmax; }; action: PROC ~ {data.device.class.DrawBits[data.device, srcBase, srcWordsPerLine, ts, tf, boxes]}; boxes[bbBox]; IF bb.smin < bb.smax THEN data.maskProc[data, bb, action]; }; AmbushMoveBoxes: PROC[device: Device, ts, tf: INTEGER, boxes: PROC[BoxProc]] ~ { data: Ambusher ~ NARROW[device.data]; bb: DeviceBox _ [smin: CARDINAL.LAST, fmin: CARDINAL.LAST, smax: 0, fmax: 0]; bbBox: PROC [b: DeviceBox] ~ { IF b.smin < bb.smin THEN bb.smin _ b.smin; IF b.fmin < bb.fmin THEN bb.fmin _ b.fmin; IF b.smax > bb.smax THEN bb.smax _ b.smax; IF b.fmax > bb.fmax THEN bb.fmax _ b.fmax; IF NAT[NAT[b.smin] - ts] < bb.smin THEN bb.smin _ b.smin - ts; IF NAT[NAT[b.fmin] - tf] < bb.fmin THEN bb.fmin _ b.fmin - tf; IF NAT[NAT[b.smax] - ts] > bb.smax THEN bb.smax _ b.smax - ts; IF NAT[NAT[b.fmax] - tf] > bb.fmax THEN bb.fmax _ b.fmax - tf; }; action: PROC ~ {data.device.class.MoveBoxes[data.device, ts, tf, boxes]}; boxes[bbBox]; IF bb.smin < bb.smax THEN data.maskProc[data, bb, action]; }; AmbushMaskChar: PROC[device: Device, s, f: INTEGER, mask: CharMask] ~ { data: Ambusher ~ NARROW[device.data]; action: PROC ~ {data.device.class.MaskChar[data.device, s, f, mask]}; bb: DeviceBox _ [smin: s+mask.sMinBB, fmin: f+mask.fMinBB, smax: 0, fmax: 0]; bb.smax _ bb.smin + mask.sSizeBB; bb.fmax _ bb.fmin + mask.fSizeBB; data.maskProc[data, bb, action]; }; END. ΆImagerRasterAmbushImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Michael Plass, July 22, 1985 4:16:15 pm PDT Doug Wyatt, July 22, 1985 4:29:17 pm PDT ΚΫ˜code™Kšœ Οmœ1™˜>Kšœ˜K˜—š œžœ2˜IKšœžœ˜%Kšœ5˜5Kšœ˜K˜—š œžœ*žœ˜PKšœžœ˜%Kšœžœ;˜GKšœ$˜$Kšœ˜K˜—š œžœ+žœ˜RKšœžœ˜%Kšœžœ=˜IKšœ$˜$Kšœ˜K˜—š œžœžœžœžœ žœ žœ˜}Kšœžœ˜%Kš œžœžœžœžœ˜Mšœžœ˜Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšœ˜—KšœžœV˜bKšœ ˜ Kšžœžœ!˜:Kšœ˜K˜—š œžœžœžœžœ žœ žœ˜}Kšœžœ˜%Kš œžœžœžœžœ˜Mšœžœ˜Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšœ˜—KšœžœV˜bKšœ ˜ Kšžœžœ!˜:Kšœ˜K˜—š œžœžœ žœ˜PKšœžœ˜%Kš œžœžœžœžœ˜Mšœžœ˜Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšžœžœ˜*Kšžœžœžœžœ˜>Kšžœžœžœžœ˜>Kšžœžœžœžœ˜>Kšžœžœžœžœ˜>Kšœ˜—Kšœžœ=˜IKšœ ˜ Kšžœžœ!˜:Kšœ˜K˜—š œžœžœ˜GKšœžœ˜%Kšœžœ9˜EKšœM˜MKšœ!˜!Kšœ!˜!Kšœ ˜ Kšœ˜K˜——šžœ˜K˜—K˜—…—>Ο