DIRECTORY Atom, CGContext, Imager, ImagerBridge, ImagerDisplay, ImagerPrivate, Graphics, GraphicsOps, Real, Terminal; ImagerBridgeImpl: CEDAR PROGRAM IMPORTS Atom, Imager, Graphics, GraphicsOps, Real, Terminal EXPORTS ImagerBridge ~ BEGIN colorDisplayDevice: ATOM _ $Gray8bpp; lfGraphicsData: CGContext.Ref ~ NARROW[Graphics.NewContext[].data]; OnLFDisplay: PROC [graphics: Graphics.Context] RETURNS [BOOLEAN] ~ { data: CGContext.Ref ~ NARROW[graphics.data]; RETURN [data.device.Show = lfGraphicsData.device.Show] }; ColorDisplayProps: PROC RETURNS [props: Atom.PropList _ NIL] ~ { vt: Terminal.Virtual _ Terminal.Current[]; colorHeight: NAT _ vt.colorHeight; IF colorHeight > 25 THEN { props _ Atom.PutPropOnList[props, $pixelsPerInch, NEW[REAL _ (colorHeight-14)/11]]; }; }; SetViewFromGraphicsContext: PUBLIC PROC [imager: Imager.Context, graphics: Graphics.Context] ~ { x, y, w, h: REAL; IF NARROW[imager.class, ImagerPrivate.Class].deviceType = $PD THEN Imager.Error[$CannotUseAHardcopyContextOnADisplay]; [x, y] _ GraphicsOps.UserToDevice[graphics,0,0]; IF GraphicsOps.UserToDevice[graphics,0,1].ty > y THEN Imager.Error[$YFlipNotSupported]; [[xmax: w, ymax: h]] _ Graphics.GetBounds[graphics]; IF OnLFDisplay[graphics] THEN { IF NARROW[imager.class, ImagerPrivate.Class].deviceType # $LFDisplay THEN { temp: Imager.Context _ Imager.Create[$LFDisplay]; imager.class _ temp.class; imager.data _ temp.data; }; } ELSE { displayData: ImagerDisplay.DisplayData; IF NARROW[imager.class, ImagerPrivate.Class].deviceType # colorDisplayDevice THEN { temp: Imager.Context _ Imager.Create[colorDisplayDevice, ColorDisplayProps[]]; imager.class _ temp.class; imager.data _ temp.data; }; displayData _ NARROW[imager.data]; x _ x*displayData.displayClass.viewUnitsPerPixel; y _ y*displayData.displayClass.viewUnitsPerPixel; w _ w*displayData.displayClass.viewUnitsPerPixel; h _ h*displayData.displayClass.viewUnitsPerPixel; }; imager.SetViewOrigin[[Real.RoundLI[x], imager.GetSurfaceBounds.h-Real.RoundLI[y]]]; imager.SetViewBox[[0, 0, Real.RoundLI[w], Real.RoundLI[h]]]; }; END. ¢ImagerBridgeImpl.mesa Michael Plass, April 9, 1984 4:19:25 pm PST Set this with the debugger to try out other color display impls. Must be on Color Display Ê ˜Jšœ™J™+J˜JšÏk œl˜uJ˜šœœ˜Jšœ4˜;Jšœ ˜Jšœ˜—J˜šœœ ˜%J™@J˜—šœ œ˜CJ˜—šÏn œœœœ˜DJšœœ˜,Jšœ0˜6Jšœ˜J˜—šžœœœœ˜@J˜*Jšœ œ˜"šœœ˜Jšœ2œœ˜SJšœ˜—Jšœ˜J˜—šžœœœ9˜`Jšœ œ˜Jšœœ5œ4˜vJšœ0˜0Jšœ/œ"˜WJšœ4˜4šœœ˜šœœ<œ˜KJšœ1˜1Jšœ˜Jšœ˜Jšœ˜—Jšœ˜—šœ˜J™J˜'šœœDœ˜SJšœN˜NJšœ˜Jšœ˜Jšœ˜—Jšœœ˜"Jšœ1˜1Jšœ1˜1Jšœ1˜1Jšœ1˜1Jšœ˜—JšœS˜SJšœ<˜