ImagerDisplayInteractiveImpl.mesa
Last Edited by: Crow, August 29, 1983 12:22 pm
DIRECTORY
ImagerBasic    USING [IntRectangle, IntPair],
Imager     USING [Context],
ImagerTransform  USING [TransformIntRectangle],
ImagerDisplay   USING [Mask, ContextData];
ImagerDisplayInteractiveImpl: CEDAR PROGRAM
IMPORTS ImagerTransform
EXPORTS Imager, ImagerDisplay
= BEGIN OPEN ImagerBasic;
NonRectangularClipper: PUBLIC SIGNAL = CODE;
Client Procedures (exported to Imager)
These operations may not work on all devices, will no-op on noninteractive devices.
MoveSurfaceRectangle: PUBLIC PROC [context: Imager.Context, source: IntRectangle,
     dest: IntPair] RETURNS [BOOLEAN] = {  -- Client's way to use BitBlt
data: REF ← context.data;
destRect: IntRectangle ← [ dest.x, dest.y, source.w, source.h];
WITH data SELECT FROM
displayContext: ImagerDisplay.ContextData => {
source ←RectClip[
ImagerTransform.TransformIntRectangle[source, displayContext.transform],
displayContext.clipper];
destRect ← RectClip[
ImagerTransform.TransformIntRectangle[destRect, displayContext.transform],
displayContext.clipper];
displayContext.deviceProcs.MovePxls[ displayContext,
[ source.x, source.y, MIN[source.w, destRect.w], MIN[source.h, destRect.h] ],
[ destRect.x, destRect.y ] ];
RETURN [TRUE];
};
ENDCASE => RETURN [FALSE];        -- No-op if not display device
};
SetColorInvert: PUBLIC PROC [context: Imager.Context] = {};
DrawBitmap: PUBLIC PROC [context: Imager.Context, base: LONG POINTER, raster: CARDINAL, area: IntRectangle] = {};
SpecialOp: PUBLIC PROC [context: Imager.Context, op: ATOM, data: REF] RETURNS [BOOLEAN] = {
RETURN [ FALSE ];
};
Display Procedures (exported to ImagerDisplay)
Fast Track
HighlightIntRectangle: PUBLIC PROC [context: Imager.Context, area: IntRectangle] = {
data: REF ← context.data;
WITH data SELECT FROM
displayContext: ImagerDisplay.ContextData => {
};
ENDCASE;             -- No-op if not display device
};
Internal Procedures
RectClip: PROC[rect: IntRectangle, clipper: ImagerDisplay.Mask] RETURNS[IntRectangle] = {
IF clipper.refRep = NIL
THEN {
sMax, fMax, fMin, sMin, fSize, sSize: INTEGER;
fMin ← MAX[clipper.fMin, rect.x];
sMin ← MAX[clipper.sMin, rect.y];
fMax ← MIN[clipper.fMin + clipper.fSize, rect.x + rect.w];
sMax ← MIN[clipper.sMin + clipper.sSize, rect.y + rect.h];
fSize ← IF fMax > fMin THEN fMax - fMin + 1 ELSE 0;
sSize ← IF sMax > sMin THEN sMax - sMin + 1 ELSE 0;
RETURN [ [fMin, sMin, fSize, sSize] ];
}
ELSE ERROR NonRectangularClipper[];
};
END.