BufferedRefresh.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on February 3, 1987
Contents: Builds up an abstraction of transparent layers onto which shapes can be drawn. Each layer may have a backing pixel map, in which case it need not be redrawn when other layers change. This scheme is used by Gargoyle and Solidviews.
DIRECTORY
BufferedRefreshTypes, Imager, ImagerBackdoor;
BufferedRefresh: CEDAR DEFINITIONS =
BEGIN
Rectangle: TYPE = Imager.Rectangle;
RefreshProc: TYPE = BufferedRefreshTypes.RefreshProc;
Layer: TYPE = BufferedRefreshTypes.Layer;
Sandwich: TYPE = REF SandwichObj;
SandwichObj: TYPE = BufferedRefreshTypes.SandwichObj;
LayerData: TYPE = REF LayerDataObj;
LayerDataObj: TYPE = BufferedRefreshTypes.LayerDataObj;
[Artwork node; type 'ArtworkInterpress on' to command tool]
CreateSandwich: PROC [layers: LIST OF Layer] RETURNS [sandwich: Sandwich];
Layers should be specified in back to front order.
FitSandwichToScreen: PROC [sandwich: Sandwich, cw, ch: INTEGER];
DrawSandwich: PROC [sandwich: Sandwich, screen: Imager.Context, clientToViewer, viewerToClient: Imager.Transformation, clientData: REF ANY, ignoreBackingMap: BOOLFALSE];
Draw the picture, derivable from the sandwich, on the screen. For backed layers that are OK, this will just dump the backing map on the screen. For backed layers that are not OK, this will remake the backing map by calling the refreshProc and dump the backing map on the screen. For unbacked layers, this will call the RefreshProc for that layer. Layers will be drawn in back-to-front order. If ignoreBackingMap is TRUE, all layers will be drawn by calling their refresh proc. Since, we currently use 1 bit per pixel backing maps, this must be done to show colors. All layers are initially NOT OK.
viewerToClient is your way to tell BufferedRefresh what your BiScrollers are doing (if you use them). Gargoyle uses the incantation:
[clientToViewer, viewerToClient] ← BiScrollers.GetStyle[].GetTransforms[BiScrollers.QuaBiScroller[gargoyleData.actionArea]];
SetLayerOK: PROC [sandwich: Sandwich, layerName: ATOM, ok: BOOL];
GetLayerOK: PROC [sandwich: Sandwich, layerName: ATOM] RETURNS [ok: BOOL];
GetLayerContext: PROC [sandwich: Sandwich, layerName: ATOM] RETURNS [backingContext: Imager.Context];
END.