BetterBridgeImpl.Mesa
Last Edited by: Spreitzer, March 23, 1985 1:38:53 pm PST
DIRECTORY BetterBridge, Graphics, Imager, ImagerPrivate, ViewerClasses, ViewerOps;
BetterBridgeImpl: CEDAR PROGRAM
IMPORTS Graphics, Imager, ViewerOps
EXPORTS BetterBridge
= {
SetViewAndClientFromViewerAndGraphics: PUBLIC PROC [imager: Imager.Context, v: ViewerClasses.Viewer, gc: Graphics.Context] = {
vx1, vx2, vy1, vy2: INTEGER;
ux0, ux1, ux2, uy0, uy1, uy2: REAL;
IF NARROW[imager.class, ImagerPrivate.Class].deviceType # $LFDisplay THEN Imager.Error[$ImagerContextIncorrectDevice];
[vx1, vy1] ← ViewerOps.UserToScreenCoords[v, 0, 0];
[vx2, vy2] ← ViewerOps.UserToScreenCoords[v, v.cw, v.ch];
IF vy1 > vy2 THEN {y: INTEGER ← vy1; vy1 ← vy2; vy2 ← y};
imager.SetViewOrigin[[vx1, vy1]];
imager.SetViewBox[[0, 0, vx2-vx1, vy2-vy1]];
imager.ConcatT[Imager.Invert[imager.state.T]];
[ux0, uy0] ← Graphics.UserToWorld[gc, 0, 0];
[ux1, uy1] ← Graphics.UserToWorld[gc, 1, 0];
[ux2, uy2] ← Graphics.UserToWorld[gc, 0, 1];
imager.ConcatT[Imager.MakeT[a: ux1-ux0, b: ux2-ux0, c: ux0-vx1, d: uy1-uy0, e: uy2-uy0, f: uy0-vy1]];
};
}.