RETURNS [Imager.Context] = {
Returns NIL if unable to create the context. If pin = FALSE, sets up bit map compatible with deviceType, but doesn't try to find device.
context: Imager.Context;
displayContext: ImagerDisplay.ContextData ← NEW[ImagerDisplay.ContextDataRep];
SELECT deviceType FROM
$CRT8 => Imager8bitDisplay.SetUp[displayContext, pin, box];
-- $LF => Imager1bitDisplay.SetUp[displayContext, pin, box];
ENDCASE => RETURN [NIL]; -- what about new devices??
displayContext.currentColor ← Imager.black;
displayContext.currentPxlValue ← displayContext.deviceProcs.colortoPixel[
NARROW[displayContext.currentColor, ImagerBasic.CIEColor] ];
displayContext.currentPosition ← [0, 0];
context ← NEW[ Imager.ContextRep ← [NIL, displayContext] ];
Imager.SetT[context, [1., 0., 0., 0., 1., 0., identity]];
Imager.SetClipper[
context,
NEW[ ImagerDisplay.MaskRep ← [
FIRST[INTEGER]/2, FIRST[INTEGER]/2, LAST[INTEGER], LAST[INTEGER]
] ]
];
Set client xform and clipper to build composite xform and clipper
RETURN [ context ];
};