ImagerDisplay.mesa
This interface provides the procedures and data structures for use with interactive displays
Last Edited by:
Crow, September 1, 1983 3:20 pm
DIRECTORY
Space  USING [Handle],
ImagerMasks USING [Mask],
ImagerBasic USING [IntRectangle, IntPair, Transformation, CIEColor, Color],
Imager   USING [Context];
ImagerDisplay: CEDAR DEFINITIONS
~ BEGIN OPEN ImagerBasic;
Basic Definitions (Numbers and Shapes)
Direction: TYPE ~ {none, left, right, up, down, upLeft, downLeft, upRight, downRight};
ByteSequence: TYPE ~ REF ByteSequenceRep;
ByteSequenceRep: TYPE ~ RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF [0..256)];
Vertex: TYPE ~ RECORD [ x, y: CARDINAL, pxlValue: LONG CARDINAL];
VtxSequence: TYPE ~ REF VtxSequenceRep;
VtxSequenceRep: TYPE ~ RECORD [SEQUENCE length: CARDINAL OF Vertex];
Context    (Implemented in ImagerDisplayContextImpl)
Mask: TYPE ~ ImagerMasks.Mask;
ImagingSpace: TYPE ~ { client, viewer, device };
Transformation: TYPE ~ ImagerBasic.Transformation;
Context: TYPE ~ Imager.Context;
ContextData: TYPE ~ REF ContextDataRep;  -- Holds the imager state
ContextDataRep: TYPE ~ RECORD [
currentColor: ImagerBasic.Color,
currentPxlValue: LONG CARDINAL,
currentPosition: ImagerBasic.IntPair,      -- CP kept in device space
   -- ********* Transformations ************
clientTransform: ImagerBasic.Transformation,
viewerTransform: ImagerBasic.Transformation,
deviceTransform: ImagerBasic.Transformation,
transform: ImagerBasic.Transformation,
            -- ***************** Clipping ***********
clientClipper: Mask,     -- clippers kept in device space
viewerClipper: Mask,
deviceClipper: Mask,
clipper: Mask,          -- composite clipper
noClip: BOOLEANFALSE,
deviceProcs: REF ImagerDisplay.DisplayClassRep,  -- Device-dependent procedures
wordsPerLine: CARDINAL, pxlBase: LONG POINTER, -- Access to image bits
storage: Space.Handle,       -- Handle for allocated storage for image bits
data: REF ANY         -- Interpretation of this depends on the procs
];
Get new display without changing anything above the device level
NewDisplay: PROC [context: Context, deviceType: ATOM];
RegisterDisplayDevice: PUBLIC PROC [class: REF DisplayClassRep];
Device
Transformations   (Implemented in ImagerDisplayTransformImpl)
SetViewerTransform: PROC [context: Context, transform: Transformation];
fast for setting common types of flips and rotates
ConcatToViewerTransform: PROC [context: Context, transform: Transformation];
SetDeviceTransform: PROC [context: Context, transform: Transformation];
Clipping    (Implemented in ImagerDisplayClipperImpl)
SetViewerClipper: PROC [context: Context, outline: IntRectangle];
ClipViewerClipper: PROC [context: Context, outline: IntRectangle];
SetDeviceClipper: PROC [context: Context, outline: IntRectangle];
Fonts
Color
Paths
Masks
Characters
Interactive   (Implemented in ImagerDisplayInteractiveImpl)
HighlightIntRectangle: PROC[context: Context, area: IntRectangle];
MoveIntRectangle: PROC [context: Context, source: IntRectangle, destination: IntPair];
SetStipplePattern: PROC[context: Context, bitsWide, bitsHigh: NAT, bits: REF ANY];
NegateXOR: PROC[context: Context]; -- set XORing to opposite state
Class
DisplayClassRep: TYPE ~ RECORD[
deviceType: ATOM,
SetUp:  PROC [displayContext: ContextData, pin: BOOLEANTRUE, box: Mask],
ShutDown: PROC [displayContext: ContextData],      
ColortoPixel: PROC [color: CIEColor] RETURNS [LONG CARDINAL],
PixeltoColor: PROC [pxlValue: LONG CARDINAL] RETURNS [CIEColor],
HilitePxls: PROC [area: IntRectangle],
MovePxls: PROC [context: ContextData, source: IntRectangle, destination: IntPair],
TransferPxls: PROC [source, destination: ContextData],
StoreScanSeg: PROC [source: ContextData, x, y, length: CARDINAL]
                   RETURNS [ByteSequence],
LoadScanSeg: PROC [destination: ContextData, x, y, length: CARDINAL,
                    segment: ByteSequence],
LoadTrapezoid: PROC [destination: ContextData,
        top, bottom, leftTop, leftBot, rightTop, rightBot: CARDINAL,
        pxlValue: LONG CARDINAL],
LoadRectangle: PROC [destination: ContextData, area: ImagerBasic.IntRectangle,
        pxlValue: LONG CARDINAL],
SetAnyPixel: PROC [destination: ContextData, x, y: CARDINAL,
       pxlValue: LONG CARDINAL, newDirection: Direction ← none],
GetAnyPixel: PROC [source: ContextData, x, y: CARDINAL,
       newDirection: Direction ← none] RETURNS [LONG CARDINAL],
SetNextPixel: PROC [pxlValue: LONG CARDINAL],
GetNextPixel: PROC [] RETURNS [LONG CARDINAL],
DrawLine: PROC [destination: ContextData, a, b: IntPair, pxlValue: LONG CARDINAL],
Tiler:   PROC [destination: ContextData, vtxCount: NAT, vertices: VtxSequence]
];  
END.