<> <> <<>> <> <> DIRECTORY; ImagerBasic: CEDAR DEFINITIONS = BEGIN <> Vec: TYPE = RECORD [x, y: REAL]; IntVec: TYPE = RECORD [x, y: INTEGER]; Edge: TYPE = RECORD [a, b: Vec]; IntEdge: TYPE = RECORD [a, b: IntVec]; Rectangle: TYPE = RECORD [x, y, w, h: REAL]; IntRectangle: TYPE = RECORD [x, y, w, h: INTEGER]; <> ImagingSpace: TYPE = { client, viewer, device }; Context: TYPE = REF ContextRep; -- Holds the imager state ContextRep: TYPE = RECORD [ procs: Procs, interactive: BOOLEAN, device: ImagingDevice, deviceProcs: DeviceProcs, -- Procedures supplied by device currentSource: SourceRecord, currentFont: Font, currentIntPosition: IntVec, -- CP kept in device space currentPosition: Vec, -- For those with floating point devices -- ********* Transformations ************ clientTransform: TransformRecord _ DefaultTransformRecord, viewerTransform: TransformRecord _ DefaultTransformRecord, deviceTransform: TransformRecord _ DefaultTransformRecord, transform: TransformRecord, -- composite transformation -- ***************** Clipping *********** clientClipper: ClipperRecord _ DefaultClipperRecord, viewerClipper: ClipperRecord _ DefaultClipperRecord, deviceClipper: ClipperRecord _ DefaultClipperRecord, clipper: ClipperRecord, -- composite clipper noClipArmed, noClip: BOOLEAN, data: REF -- Interpretation of this depends on the procs ]; <> TransformType: TYPE = { none, identity, rot90, rot180, rot270, mirrorX, mirrorY, mirror45Deg, mirror135Deg, hard }; TransformRecord: TYPE = RECORD [ x, y: INTEGER, type: TransformType, transformation: Transformation -- used if type is "hard" ]; DefaultTransformRecord: TransformRecord = [0, 0, identity, NIL]; Transformation: TYPE = REF TransformRep; TransformRep: TYPE = RECORD [ a, b, c, d, e, f: REAL ]; <> <> <> <> <> Visibility: TYPE = {visible, partlyVisible, invisible}; ClipperType: TYPE = {none, rectangle, path}; ClipperRecord: TYPE = RECORD [ xMin, xMax, yMin, yMax: INTEGER, type: ClipperType, clipper: Clipper -- used if type is "path" ]; DefaultClipperRecord: ClipperRecord = [0, 1024, 0, 1024, rectangle, NIL]; Clipper: TYPE = REF ClipperRep; ClipperRep: TYPE = RECORD [ xMin, xMax, yMin, yMax: REAL, paths: LIST OF RECORD [exclude: BOOLEAN, path: Path] ]; <> ImagingDevice: TYPE = ATOM; -- i.e. $LF, $CRT8, $CRT24, $PD, $IP, etc. InteractiveImagingDevice: TYPE = ATOM; -- i.e. $LF, $CRT8, $CRT24 PxlValue: TYPE = LONG CARDINAL; ByteSequence: TYPE = REF ByteSequenceRep; ByteSequenceRep: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF [0..256)]; SetUpProc: TYPE = PROC [] RETURNS [TransformRecord, ClipperRecord, DeviceProcs]; -- get memory, pin it, set the transform, clipper, and device procs ShutDownProc: TYPE = PROC []; -- free memory OpenPixelBufferProc: TYPE = PROC [buffer: PixelArray _ NIL] RETURNS [PixelArray]; -- redirect writes for double-buffer ClosePixelBufferProc: TYPE = PROC []; -- drop pixel buffer ref RGBtoPixelProc: TYPE = PROC [color: RGBValue] RETURNS [PxlValue]; -- Color to device transform PixeltoRGBProc: TYPE = PROC [pxlValue: PxlValue] RETURNS [RGBValue]; HilitePxlsProc: TYPE = PROC [area: IntRectangle]; -- Device dependent highlighting scheme MovePxlsProc: TYPE = PROC [source: IntRectangle, destination: IntVec]; -- move on display GetPxlsProc: TYPE = PROC [source: IntRectangle] RETURNS [PixelArray]; LoadPxlsProc: TYPE = PROC [source: PixelArray _ NIL, destination: IntVec]; LoadScanSegProc: TYPE = PROC [x, y, length: CARDINAL, segment: ByteSequence]; LoadTrapezoidProc: TYPE = PROC [top, bottom, leftTop, leftBot, rightTop, rightBot: CARDINAL, pxlValue: PxlValue]; -- Scan convert trapezoid, constant color SetPixelProc: TYPE = PROC [x, y: CARDINAL, pxlValue: PxlValue]; GetPixelProc: TYPE = PROC [x, y: CARDINAL] RETURNS [PxlValue]; DrawLineProc: TYPE = PROC [a, b: IntVec, pxlValue: PxlValue]; -- fast line, constant color DeviceProcs: TYPE = REF DeviceProcsRec; DeviceProcsRec: TYPE = RECORD[ setUp: SetUpProc, shutDown: ShutDownProc, openPixelBuffer: OpenPixelBufferProc, closePixelBuffer: ClosePixelBufferProc, RGBtoPixel: RGBtoPixelProc, pixeltoRGB: PixeltoRGBProc, hilitePxls: HilitePxlsProc, movePxls: MovePxlsProc, getPxls: GetPxlsProc, loadPxls: LoadPxlsProc, loadScanSeg: LoadScanSegProc, loadTrapezoid: LoadTrapezoidProc, setPixel: SetPixelProc, getPixel: GetPixelProc, drawLine: DrawLineProc ]; -- this doesn't seem to help PD and InterPress master devices much, what to do?? <> Font: TYPE = REF; <> SourceType: TYPE = { black, white, constant, pixelarray, sampled, functional }; RGBValue: TYPE = RECORD [ red, green, blue: REAL]; AISFile: TYPE[1]; -- to be filled in SourceRecord: TYPE = RECORD [ type: SourceType, color: RGBValue, pxlValue: PxlValue, -- TYPE = LONG CARDINAL samples: REF ANY _ NIL -- gets NARROWed by called procedure ]; <> SampleSequence: TYPE = REF SampleSequenceRep; SampleSequenceRep: TYPE = RECORD [ length: NAT, seq: SEQUENCE maxLength: NAT OF LONG CARDINAL ]; SampledSource: TYPE = REF SampledSourceRep; SampledSourceRep: TYPE = RECORD [ transformation: Transformation, <> colorModel: ColorModel, maximumSampleValue: LONG CARDINAL, sampledSourceProc: PROC [sampledSource: SampledSource, sampleSequence: SampleSequence, <> numberOfSamples: NAT, x0, y0, deltaX, deltaY: INTEGER -- Description of the sample line, in the SampledImage's coordinate system. The delta values tell how to get to the next point. ] _ NIL, data: REF ANY ]; ColorModel: TYPE = ATOM; <> <> PixelArray: TYPE = REF PixelArrayRep; PixelArrayRep: TYPE = RECORD [ pixelsPerWord: CARDINAL, numberOfRows: CARDINAL, pixelsPerRow: CARDINAL, array: LONG POINTER, -- pointer to block of memory representing pixels colorTable: REF -- nil, or pointer to pixel-to-color translation table ]; <> <> Path: TYPE = REF PathRep; PathRep: TYPE = RECORD [ generateProc: PROC [ path: Path, transformation: Transformation, move: PROC [Vec], line: PROC [Vec], curve: PROC [Vec, Vec, Vec] ], data: REF ANY ]; <> StrokeEnds: TYPE = {butt, square, round}; <> <> Procs: TYPE = REF ProcsRec; ProcsRec: TYPE; END.