<> <> <> <> <<>> <> <<>> DIRECTORY Basics USING [LongMult], PrincOps USING [DstFunc, SrcFunc]; ImagerPixelMap: CEDAR DEFINITIONS IMPORTS Basics ~ BEGIN <<>> <> -- ^ -- f | -- | -- | +----------------------------+ -- | | | -- | |rast * bitsPerWord / bitsPerPixel | -- | | | -- | | +------------+ | -- | | | | | -- | | | | | -- | | |fSize | | -- | | | | | -- | | sMin | sSize | | -- | |<-- -->+------------+ | -- | | ^ | -- | | |fMin | -- | sOrigin | v lines | -- |<---- ---->+----------------------------+ -- | ^origin of buffer -- | | -- | |fOrigin -- | | -- | | -- | v -- +--------------------------------------------> -- Device space origin s <<>> <> PixelMap: TYPE ~ RECORD [ <> sOrigin, fOrigin: INTEGER, sMin, fMin: INTEGER, sSize, fSize: NAT, refRep: REF PixelMapRep ]; DeviceRectangle: TYPE ~ RECORD[sMin, fMin: INTEGER, sSize, fSize: NAT]; Intersect: PROC [a, b: DeviceRectangle] RETURNS [DeviceRectangle]; <> <<>> Create: PROC [lgBitsPerPixel: [0..4], bounds: DeviceRectangle] RETURNS [PixelMap]; <> <<>> CreateFrameBuffer: UNSAFE PROC [pointer: LONG POINTER, words: LONG CARDINAL, lgBitsPerPixel: [0..4], rast: CARDINAL, lines: CARDINAL, ref: REF _ NIL] RETURNS [PixelMap]; <> <<>> Clear: PROC [pixelMap: PixelMap]; <> <<>> Reshape: PROC [refRep: REF PixelMapRep, lgBitsPerPixel: [0..4], bounds: DeviceRectangle] RETURNS [PixelMap]; <> <<>> Copy: PROC [p: PixelMap, scratch: REF PixelMapRep _ NIL] RETURNS [PixelMap]; <> <<>> ShiftMap: PROC [p: PixelMap, s, f: INTEGER] RETURNS [PixelMap]; <> <<>> ShiftWindow: PROC [p: PixelMap, s, f: INTEGER] RETURNS [PixelMap]; <> <<>> Clip: PROC [p: PixelMap, bounds: DeviceRectangle] RETURNS [PixelMap]; <> <<>> SetWindow: PROC [p: PixelMap, bounds: DeviceRectangle] RETURNS [PixelMap]; <> <<>> Window: PROC [p: PixelMap] RETURNS [DeviceRectangle]; BufferBounds: PROC [p: PixelMap] RETURNS [DeviceRectangle]; <> <<>> BoundedWindow: PROC [p: PixelMap] RETURNS [DeviceRectangle]; <> <<>> GetPixel: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL]; <> <<>> <> GetBit: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL] ~ TRUSTED INLINE {RETURN [LOOPHOLE[source.refRep.pointer + Basics.LongMult[(s - source.sOrigin), source.refRep.rast], LONG POINTER TO PACKED ARRAY [0..0) OF [0..2)][f - source.fOrigin]]}; Get2Bits: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL] ~ TRUSTED INLINE {RETURN [LOOPHOLE[source.refRep.pointer + Basics.LongMult[(s - source.sOrigin), source.refRep.rast], LONG POINTER TO PACKED ARRAY [0..0) OF [0..4)][f - source.fOrigin]]}; Get4Bits: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL] ~ TRUSTED INLINE {RETURN [LOOPHOLE[source.refRep.pointer + Basics.LongMult[(s - source.sOrigin), source.refRep.rast], LONG POINTER TO PACKED ARRAY [0..0) OF [0..16)][f - source.fOrigin]]}; Get8Bits: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL] ~ TRUSTED INLINE {RETURN [LOOPHOLE[source.refRep.pointer + Basics.LongMult[(s - source.sOrigin), source.refRep.rast], LONG POINTER TO PACKED ARRAY [0..0) OF [0..256)][f - source.fOrigin]]}; Get16Bits: PROC [source: PixelMap, s, f: INTEGER] RETURNS [CARDINAL] ~ TRUSTED INLINE {RETURN [LOOPHOLE[source.refRep.pointer + Basics.LongMult[(s - source.sOrigin), source.refRep.rast], LONG POINTER TO PACKED ARRAY [0..0) OF CARDINAL][f - source.fOrigin]]}; Equal: PROC [a, b: PixelMap] RETURNS [BOOLEAN]; <> <<>> IsAll: PROC [pixelMap: PixelMap, value: CARDINAL _ 0] RETURNS [BOOLEAN]; <> <<>> Trim: PROC [pixelMap: PixelMap, background: CARDINAL _ 0] RETURNS [PixelMap]; <> <<>> Fill: PROC [dest: PixelMap, area: DeviceRectangle, value: CARDINAL, function: Function _ [null, null]]; Function: TYPE ~ RECORD [dstFunc: PrincOps.DstFunc, srcFunc: PrincOps.SrcFunc]; <<[null, null] makes zero bits white, one bits black>> <<[or, null] makes zero bits transparent, one bits black>> <<[and, null] makes zero bits white, one bits black>> <<[and, complement] makes zero bits transparent, one bits white>> <<[xor, null] makes zero bits transparent, one bits inverted>> <> <<>> Transfer: PROC [dest, source: PixelMap, function: Function _ [null, null]]; <> <<>> Tile: TYPE ~ RECORD [ sOrigin, fOrigin: INTEGER, sSize, fSize: NAT, phase: INTEGER, refRep: REF PixelMapRep ]; <> <<>> CreateTile: PROC [pixelMap: PixelMap, phase: INTEGER _ 0, fSizeHint: NAT _ 100, scratch: REF PixelMapRep _ NIL] RETURNS [tile: Tile]; <> <<>> TileFromStipple: PROC [stipple: CARDINAL, scratch: REF PixelMapRep _ NIL] RETURNS [tile: Tile]; <> <<>> TileFromConstant: PROC [pixelValue: CARDINAL, lgBitsPerPixel: [0..4] _ 0, scratch: REF PixelMapRep _ NIL] RETURNS [tile: Tile]; <> <<>> TransferTile: PROC [dest: PixelMap, tile: Tile, function: Function _ [null, null]]; <> <<>> Rotate: PROC [pixelMap: PixelMap, scratch: REF PixelMapRep _ NIL] RETURNS [PixelMap]; <> <<>> Reflect: PROC [pixelMap: PixelMap, scratch: REF PixelMapRep _ NIL] RETURNS [PixelMap]; <> <<>> PixelMapRep: TYPE ~ RECORD [ ref: REF, pointer: LONG POINTER, words: LONG CARDINAL, lgBitsPerPixel: [0..4], -- logarithm base two of bitsPerPixel rast: CARDINAL, lines: CARDINAL <> ]; END.