CIITestDeviceImpl.mesa
Copyright Ó 1993 by Xerox Corporation. All rights reserved.
Michael Plass, September 28, 1993 4:14 pm PDT
DIRECTORY
CII USING [Handle, MakeHandle],
CIIPrivate USING [StateRep],
Commander USING [CommandObject, CommandProc, Handle, Register],
CommanderOps USING [Failed],
Imager USING [Context, MakeGray],
ImagerBox USING [Rectangle],
ImagerClipper USING [Clipper],
ImagerColor USING [Color],
ImagerDevice USING [ClipWorksProc, Device, DeviceClipper, DeviceClipperRep, DeviceState, WorksClass],
ImagerDeviceInterchange USING [DestroyInterchangeState, InterchangeState],
ImagerDeviceVector USING [DVec, DVecRep, ScaledVec],
ImagerDeviceWorks USING [Clip],
ImagerManhattan USING [Box, CreateFromBox, Polygon],
ImagerRaster USING [GetInterchangeState],
ImagerTransformation USING [Scale],
NotReallyAViewer USING [GetCurrentContext],
Scaled USING [Value];
CIITestDeviceImpl: PROGRAM
IMPORTS CII, Commander, CommanderOps, Imager, ImagerManhattan, ImagerDeviceWorks, ImagerTransformation, ImagerDeviceInterchange, ImagerRaster, NotReallyAViewer
~ BEGIN
Color: TYPE = ImagerColor.Color;
Device: TYPE = ImagerDevice.Device;
Rectangle: TYPE = ImagerBox.Rectangle;
DeviceClipper: TYPE = ImagerDevice.DeviceClipper;
ExternalNames: PROC = MACHINE CODE {
"^ExternalNames
TestDevice  CII←TestDevice
";
};
TestDevice: <<CPUBLIC>> PROC RETURNS [h: CII.Handle] ~ {
IF context = NIL THEN CommanderOps.Failed["No context!"] ELSE {
iState: ImagerDeviceInterchange.InterchangeState ~ ImagerRaster.GetInterchangeState[context];
device: Device;
state: State;
IF iState = NIL THEN CommanderOps.Failed["No iState!"];
device ¬ iState.device;
iState.device ¬ NIL;
ImagerDeviceInterchange.DestroyInterchangeState[iState];
state ¬ NEW[StateRep ¬ [
device: device,
color: Imager.MakeGray[1.0],
dcolor: NIL,
transformation: ImagerTransformation.Scale[1.0],
viewClipper: NEW[ImagerDevice.DeviceClipperRep ¬ [clipBox: device.state.bounds, clipMask: ImagerManhattan.CreateFromBox[device.state.bounds]]],
clientClipper: NIL,
cp: NEW[ImagerDeviceVector.DVecRep]
]];
ImagerDeviceWorks.Clip[device: device, viewClipper: state.viewClipper, clipperToDevice: ImagerTransformation.Scale[1], clientClipper: state.clientClipper];
RETURN [CII.MakeHandle[state]]
};
};
State: TYPE ~ REF StateRep;
StateRep: TYPE ~ CIIPrivate.StateRep;
context: Imager.Context ¬ NIL;
CIIViewerCommand: Commander.CommandProc ~ CHECKED {
context ¬ NotReallyAViewer.GetCurrentContext[cmd];
};
ExternalNames[];
Commander.Register["CIIViewer", CIIViewerCommand, "Make a viewer for CII debug"];
END.