Copyright (C) 1994, Digital Equipment Corp.
Digital Internal Use Only
Created on Wed Feb 15 15:52:21 PST 1995 by najork
INTERFACEThis module provides procedures for modifying device context, and for undoing those modifications. These procedures fall into two categories:WinContext ; IMPORT Ctypes, PaintPrivate, Point, VBT, WinDef, WinScreenType;
PushMumble(hdc, ...) changes the device context hdc to be appropriate
for subsequent mumble operations; Pop(ctxt) reverts the device context
back to its prior state.
Push and pop operations must always be paired. The push operation returns a context record, which must be passed as a parameter to the corresponding pop operation. The context record contains the information needed to restore the original device context. Using a record type instead of an object type avoids heap allocations.
A possible further optimization would be to pass a caller-allocated context record to push, to avoid copying of the return argument.
TYPE
T = RECORD
hdc : WinDef.HDC; (* device context *)
rop2 : Ctypes.int := 0; (* binary raster operation code *)
(* Note: We do not need to save the ternary raster operation code *)
pen : WinDef.HPEN := NIL;
brush: WinDef.HBRUSH := NIL;
END;
(* The following aspects of a device context are not saved
(and therefore not restored either):
FillStyle, Text Color, Background Color, ... *)
PROCEDURE PushTint (hdc: WinDef.HDC;
st : WinScreenType.T;
op : PaintPrivate.PaintOp): T;
Modifyhdcto be suitable for tint painting. This procedure is the moral equivalent ofXGC.ResolveTintGCin xvbt.
PROCEDURE PushTexture (hdc : WinDef.HDC;
st : WinScreenType.T;
op : PaintPrivate.PaintOp;
pm : PaintPrivate.Pixmap;
delta: Point.T): T;
Modifyhdcto be suitable for texture painting. This procedure is the moral equivalent ofXGC.ResolveTextureGCin xvbt.
PROCEDURE PushFill (hdc : WinDef.HDC;
st : WinScreenType.T;
op : PaintPrivate.PaintOp;
pm : PaintPrivate.Pixmap;
delta: Point.T;
wind : VBT.WindingCondition): T;
Modifyhdcto be suitable for filling polygons. This procedure is the moral equivalent ofXGC.ResolveFillGCin xvbt.
PROCEDURE PushStroke (hdc : WinDef.HDC;
st : WinScreenType.T;
op : PaintPrivate.PaintOp;
pm : PaintPrivate.Pixmap;
delta: Point.T;
width: CARDINAL;
end : VBT.EndStyle;
join : VBT.JoinStyle): T;
Modifyhdcto be suitable for stroking lines. This procedure is the moral equivalent ofXGC.ResolveStrokeGCin xvbt.
PROCEDURE Pop (READONLY ctxt: T);
Undo the modifications to the device context ctxt.hdc. END WinContext.