DIRECTORY ImagerBasic USING [Context, ImagingDevice, ContextRep], Imager USING [Mark, nullMark, Inclusions, ResetTransform], Imager8bitDisplay USING [SetUp]; ImagerContextImpl: CEDAR PROGRAM IMPORTS Imager, Imager8bitDisplay EXPORTS Imager = BEGIN OPEN ImagerBasic; CreateContext: PUBLIC PROC [device: ImagingDevice] RETURNS [Context] = { context: Context _ NEW[ContextRep]; context.device _ device; SELECT device FROM $CRT8 => { [ context.deviceTransform, context.deviceClipper, context.deviceProcs ] _ Imager8bitDisplay.SetUp[]; context.interactive _ TRUE; }; ENDCASE => ERROR; -- attempt to scrounge up procs record from somewhere context.currentSource _ [white, [1., 1., 1.], 255, NIL]; context.currentFont _ NIL; context.currentIntPosition _ [0, 0]; context.currentPosition _ [0., 0.]; context.viewerTransform _ [0, 0, identity, NIL]; Imager.ResetTransform[context]; -- Set client xform to identity and build composite xform context.clipper _ context.clientClipper _ context.viewerClipper _ context.deviceClipper; context.noClipArmed _ context.noClip _ FALSE; RETURN [ context ]; }; DestroyContext: PUBLIC PROC [context: Context] = { }; Save: PUBLIC PROC [context: Context, what: Imager.Inclusions] RETURNS [Imager.Mark] = { RETURN [ Imager.nullMark ]; }; Restore: PUBLIC PROC [context: Context, mark: Imager.Mark _ Imager.nullMark] = {}; NewFrame: PUBLIC PROC [context: Context] = { -- who keeps the background color?? IF context.interactive THEN context.deviceProcs.loadPxls[NIL, [0, 0]]; -- Blt buffer to display context.deviceProcs.loadTrapezoid[ context.clipper.yMax, context.clipper.yMin, -- clear context.clipper.xMin, context.clipper.xMin, context.clipper.xMax, context.clipper.xMax, context.currentSource.pxlValue ]; }; END. όImagerContextImpl.mesa Created April 8, 1983 Last Edit By: Plass, April 8, 1983 7:38 pm Last Edited by: Crow, June 15, 1983 7:02 pm Client-called Procedures Called by the viewers package, or other utilities, to set up a context. Returns NIL if unable to create the context. Remove all traces of the given context, clean up VM. Note the current state of the display context, and return a mark value which can later be passed to Restore. Restore the state of the display context to its condition prior to the call on Save that returned the given mark. Defaulting the mark means restore to the most recent Save. Clear, Next Page, etc. If printer or InterPress, start new page; if double-buffering, display newly completed image; otherwise clear inside context. Κ˜headšœ™J™™ J™—J™+unitšΟk œ˜ Jšœ œ'˜8Jšœœ.˜;Jšœœ ˜ ——šœ ˜ Jšœ˜!Jšœ˜Jšœœœ ˜—™šΟn œ œœ˜HJšœPœ!™tJšœœ ˜#Jšœ˜Jšœ˜šœ'˜'Jšœ˜Jšœ<˜˜RJšœ¬™¬—Ihead4™šžœ œŸ#˜QJšœ}™}Lšœœœ Ÿ˜_JšœPŸ˜XJšœ5˜5Jšœ5˜5Jšœ+˜+Jšœ˜—J˜J˜Jšœ˜——…—