BiScrollersTransforms.mesa
Copyright © 1992 by Xerox Corporation. All rights reserved.
Bier, March 19, 1993 5:29 pm PST
Contents: A viewers-independent way to perform the BiScrollers transformations on a transformation matrix
DIRECTORY
BiScrollersTransformsTypes, Geom2D, ImagerTransformation, Vector2;
BiScrollersTransforms: CEDAR DEFINITIONS = BEGIN
AgeOp: TYPE = BiScrollersTransformsTypes.AgeOp;
Axis: TYPE = Geom2D.Axis;
Location: TYPE = BiScrollersTransformsTypes.Location;
Preservation:
TYPE =
REAL
--[0.0 .. 1.0]--;
horizontally (axis X), 0.0 is left and 1.0 is right;
vertically (axis Y), 0.0 is bottom and 1.0 is top.
PreservationPair: TYPE = ARRAY Axis OF Preservation;
Rect: TYPE = Geom2D.Rect;
RotateOp: TYPE = BiScrollersTransformsTypes.RotateOp;
ScaleOp: TYPE = BiScrollersTransformsTypes.ScaleOp;
Transform: TYPE = ImagerTransformation.Transformation;
Vec: TYPE = Vector2.VEC;
Scale:
PROC [old: Transform, op: ScaleOp, cw, ch:
REAL, pp: PreservationPair, vanilla: Transform ←
NIL, mayStretch:
BOOL ←
TRUE]
RETURNS [new: Transform];
old is the clientToViewer transformation
Rotate:
PROC [old: Transform, op: RotateOp, cw, ch:
REAL, pp: PreservationPair, vanilla: Transform ←
NIL]
RETURNS [new: Transform];
old is the clientToViewer transformation
Shift:
PROC [old: Transform, dx, dy:
REAL]
RETURNS [new: Transform];
old is the clientToViewer transformation
Align:
PROC [old: Transform, client, viewer: Location, doX, doY:
BOOL ¬
TRUE, cw, ch:
REAL, extremaProc: ExtremaProc, clientData:
REF, ageOp: AgeOp ¬ remember]
RETURNS [new: Transform];
old is the clientToViewer transformation
BoxScale:
PROC [old: Transform, from, to: Rect
--both in viewer coords--, uniformly:
BOOL ¬
TRUE, mayStretch:
BOOL ←
TRUE, preferIntegerCoefficients:
BOOL ←
FALSE]
RETURNS [new: Transform];
old is the clientToViewer transformation
Change scale and offsets so that client data previously in `from' covers as much as possible of `to'.
ExtremaProc: TYPE = PROC [clientData: REF, direction: Vec] RETURNS [min, max: Vec];
Fit:
PROC [old: Transform, uniformly:
BOOL, cw, ch:
REAL, extremaProc: ExtremaProc, clientData:
REF, mayStretch:
BOOL ←
TRUE, preferIntegerCoefficients:
BOOL ←
FALSE]
RETURNS [new: Transform];
old is the clientToViewer transformation
DoBSUserAction:
PROC [old: Transform, input:
LIST
OF
REF, cw, ch:
REAL, pp: PreservationPair, vanilla, previous: Transform ←
NIL, mayStretch:
BOOL ←
FALSE, preferIntegerCoefficients:
BOOL ←
FALSE, extremaProc: ExtremaProc, clientData:
REF]
RETURNS [new: Transform];
END.