-- File TestCIFUtilities.Mesa -- Last changed: 14-Jul-81 16:27:49 DIRECTORY CIFUtilitiesDefs USING [DisplayContext, InitCedarGraphics, SetDisplayContext, GetDisplayContext, GetBaseContext, SetClipRectangle, GetClipRectangle, GetBaseClipRectangle, DrawClipRectangle, ClearClipRectangle, DrawRectangleOutline, MoveTo, DrawTo, EnableClipping, DisableClipping, SetUniformView, ScreenParams, TrackBox, MoveCursorTo], JaMFnsDefs USING [Register, PushReal, GetReal, PushLongInteger, PushInteger]; CIFUtilities: PROGRAM IMPORTS CIFUtilitiesDefs, JaMFnsDefs = BEGIN OPEN CIFUtilitiesDefs, JaMFnsDefs; dc: DisplayContext _ NIL; CallInitCedarGraphics: PROCEDURE = BEGIN InitCedarGraphics[]; END; CallSetDisplayContext: PROCEDURE = BEGIN SetDisplayContext[dc]; END; CallGetDisplayContext: PROCEDURE = BEGIN dc _ GetDisplayContext[]; END; CallGetBaseContext: PROCEDURE = BEGIN dc _ GetBaseContext[]; END; CallSetClipRectangle: PROCEDURE = --set clip rectangle in current context BEGIN t: REAL _ GetReal[]; r: REAL _ GetReal[]; b: REAL _ GetReal[]; l: REAL _ GetReal[]; SetClipRectangle[[l,b,r,t]]; END; CallGetClipRectangle: PROCEDURE = BEGIN l,b,r,t: REAL; [[l,b,r,t]] _ GetClipRectangle[]; PushReal[l]; PushReal[b]; PushReal[r]; PushReal[t]; END; CallGetBaseClipRectangle: PROCEDURE = BEGIN l,b,r,t: REAL; [[l,b,r,t]] _ GetBaseClipRectangle[]; PushReal[l]; PushReal[b]; PushReal[r]; PushReal[t]; END; CallDrawClipRectangle: PROCEDURE = BEGIN DrawClipRectangle[]; END; CallClearClipRectangle: PROCEDURE = BEGIN ClearClipRectangle[]; END; CallDrawRectangleOutline: PROCEDURE = BEGIN t: REAL _ GetReal[]; r: REAL _ GetReal[]; b: REAL _ GetReal[]; l: REAL _ GetReal[]; DrawRectangleOutline[[l,b,r,t]]; END; CallMoveTo: PROCEDURE = BEGIN y: REAL _ GetReal[]; x: REAL _ GetReal[]; MoveTo[x,y]; END; CallDrawTo: PROCEDURE = BEGIN y: REAL _ GetReal[]; x: REAL _ GetReal[]; DrawTo[x,y]; END; CallEnableClipping: PROCEDURE = BEGIN EnableClipping[]; END; CallDisableClipping: PROCEDURE = BEGIN DisableClipping[]; END; CallSetUniformView: PROCEDURE = --Set up transform to map rectangles, but without introducing differential scaling --Minimum scale factor is used, and centers will correspond BEGIN tot: REAL _ GetReal[]; tor: REAL _ GetReal[]; tob: REAL _ GetReal[]; tol: REAL _ GetReal[]; fromt: REAL _ GetReal[]; fromr: REAL _ GetReal[]; fromb: REAL _ GetReal[]; froml: REAL _ GetReal[]; SetUniformView[[froml,fromb,fromr,fromt],[tol,tob,tor,tot]]; END; CallScreenParams: PROCEDURE = BEGIN base: LONG POINTER; raster: CARDINAL; height: CARDINAL; [base,raster,height] _ ScreenParams[]; PushLongInteger[LOOPHOLE[base]]; PushInteger[raster]; PushInteger[height]; END; CallTrackBox: PROCEDURE = BEGIN y: REAL _ GetReal[]; x: REAL _ GetReal[]; TrackBox[x,y,Red]; END; CallMoveCursorTo: PROCEDURE = BEGIN y: REAL _ GetReal[]; x: REAL _ GetReal[]; MoveCursorTo[x,y]; END; Register["init"L,CallInitCedarGraphics]; Register["setdc"L,CallSetDisplayContext]; Register["getdc"L,CallGetDisplayContext]; Register["getbasedc"L,CallGetBaseContext]; Register["setclip"L,CallSetClipRectangle]; Register["getclip"L,CallGetClipRectangle]; Register["getbaseclip"L,CallGetBaseClipRectangle]; Register["drawclip"L,CallDrawClipRectangle]; Register["clearclip"L,CallClearClipRectangle]; Register["drawrect"L,CallDrawRectangleOutline]; Register["moveto"L,CallMoveTo]; Register["drawto"L,CallDrawTo]; Register["enableclip"L,CallEnableClipping]; Register["disableclip"L,CallDisableClipping]; Register["setuniform"L,CallSetUniformView]; Register["screenparams"L,CallScreenParams]; Register["trackbox"L,CallTrackBox]; Register["movecursor"L,CallMoveCursorTo]; END.