<<>> <> <> <> <> <<>> DIRECTORY G2dBasic, Imager, ImagerPixel, ImagerSample, SF; <<>> CtBasic: CEDAR DEFINITIONS IMPORTS ~ BEGIN <> IntegerPair: TYPE ~ G2dBasic.IntegerPair; -- RECORD [x, y: INTEGER ¬ 0] RealPair: TYPE ~ G2dBasic.Pair; -- RECORD [x, y: REAL ¬ 0.0] Context: TYPE ~ Imager.Context; Rectangle: TYPE ~ Imager.Rectangle; -- RECORD [x, y, w, h: REAL] PixelMap: TYPE ~ ImagerPixel.PixelMap; SampleBuffer: TYPE ~ ImagerSample.SampleBuffer; SampleMap: TYPE ~ ImagerSample.SampleMap; Box: TYPE ~ SF.Box; -- RECORD [min, max: Vec ¬ [0, 0]] Vec: TYPE ~ SF.Vec; -- RECORD [s, f: INTEGER] RGB: TYPE ~ RECORD [r, g, b: BYTE ¬ 0]; Channel: TYPE ~ RECORD [ type: ATOM ¬ NIL, -- use of channel map: SampleMap ¬ NIL -- channel image ]; SampleMaps: TYPE ~ REF SampleMapsRep; SampleMapsRep: TYPE ~ RECORD [ x, y, w, h: NAT ¬ 0, -- the box, derived from the sample maps box: Box ¬ [[0,0], [0,0]], -- read only: dimensions of maps size: Vec ¬ [0, 0], -- read only: size of maps bpp: NAT ¬ 8, -- bits per pixel: 8, 24 or other nChannels: NAT ¬ 0, -- number of sample maps element: SEQUENCE maxLength: NAT OF Channel ]; <> <> PixelArray: TYPE ~ REF PixelArrayRep; PixelArrayRep: TYPE ~ RECORD [ bpp: NAT ¬ 8, -- bits per pixel x, y, w, h: NAT ¬ 0, -- dimensions of array box: Box ¬ [[0,0], [0,0]], -- read only: dimensions of maps size: Vec ¬ [0, 0], -- read only: size of maps element: SEQUENCE maxLength: NAT OF SampleBuffer ]; <> <> <> GetBpp: PROC RETURNS [NAT]; <> <> SampleMapsFromPixelMap: PROC [pixelMap: PixelMap] RETURNS [SampleMaps]; <> <> <> <> <<>> SampleMapsFromMaps: PROC [map1, map2, map3: SampleMap] RETURNS [SampleMaps]; <> <<>> CreateMaps: PROC [bpp: NAT, x, y, w, h: NAT, allocateMaps: BOOL ¬ TRUE] RETURNS [SampleMaps]; <> CopyOfMaps: PROC [maps: SampleMaps, x, y, w, h: NAT] RETURNS [SampleMaps]; <> ClipMaps: PROC [maps: SampleMaps, x, y, w, h: NAT]; <> MoveMaps: PROC [maps: SampleMaps, srcMin, dstMin, size: Vec]; <> <<>> ShiftMaps: PROC [maps: SampleMaps, delta: Vec] RETURNS [SampleMaps]; <> <<>> FillMaps: PROC [maps: SampleMaps, bw, r, g, b: CARDINAL ¬ 0]; <> <<>> CopyMaps: PROC [src, dst: SampleMaps]; <> CopyClippedMaps: PROC [src, dst: SampleMaps, srcBox, dstBox: Box]; <> <<>> ReIndexMaps: PUBLIC PROC [maps: SampleMaps, delta: Vec ¬ [0, 0], box: Box ¬ SF.maxBox]; <> <<>> ReleaseDescriptors: PROC [maps: SampleMaps]; <> <<8 Bit Operations>> ValueProc: TYPE ~ PROC [x, y: INTEGER, clientData: REF ¬ NIL] RETURNS [value: BYTE]; <<>> FillBWMap: PROC [map: SampleMap, color: CARDINAL]; <> <<>> PutBWPixel: PROC [map: SampleMap, x, y: INTEGER, value: CARDINAL]; <> <<>> GetBWPixel: PROC [map: SampleMap, x, y: INTEGER] RETURNS [CARDINAL]; <> <<>> PutBWBox: PROC [map: SampleMap, x0, y0, x1, y1: INTEGER, value: CARDINAL]; <> <<>> PutBWLine: PROC [map: SampleMap, x0, y0, x1, y1: INTEGER, value: CARDINAL]; <> <<>> PutBWScanLine: PROC [map: SampleMap, y: INTEGER, proc: ValueProc, clientData: REF ¬ NIL]; <> <<>> PutBWFrame: PROC [map: SampleMap, proc: ValueProc, clientData: REF ¬ NIL]; <> <> <<24 Bit Operations>> RGBProc: TYPE ~ PROC [x, y: INTEGER, clientData: REF ¬ NIL] RETURNS [rgb: RGB]; <<>> FillRGBMap: PROC [maps: SampleMaps, rgb: RGB]; <> <<>> PutRGBPixel: PROC [maps: SampleMaps, x, y: INTEGER, rgb: RGB]; <> <<>> GetRGBPixel: PROC [maps: SampleMaps, x, y: INTEGER] RETURNS [RGB]; <> PutRGBBox: PROC [maps: SampleMaps, x0, y0, x1, y1: INTEGER, rgb: RGB]; <> <<>> PutRGBLine: PROC [maps: SampleMaps, x0, y0, x1, y1: INTEGER, rgb: RGB]; <> <<>> PutRGBScanLine: PROC [maps: SampleMaps, y: INTEGER, proc: RGBProc, clientData: REF ¬ NIL]; <> <> PutRGBFrame: PROC [maps: SampleMaps, proc: RGBProc, clientData: REF ¬ NIL]; <> <> <> <> InitializePixelArray: PROC [box: Box, bpp: NAT ¬ 8] RETURNS [PixelArray]; <> <<>> AllocatePixelArray: PROC [box: Box, bpp: NAT ¬ 8] RETURNS [PixelArray]; <> <<>> PixelArrayFromSampleMap: PROC [map: SampleMap] RETURNS [PixelArray]; <> <<>> SampleMapFromPixelArray: PROC [pa: PixelArray] RETURNS [SampleMap]; <> <<>> TransferPixelArrayToMap: PROC [pa: PixelArray, map: SampleMap]; <> PixelArrayBoxToMap: PROC [pa: PixelArray, map: SampleMap, x1, y1, x2, y2: INTEGER]; <> BoxFromPixelArray: PROC [pa: PixelArray] RETURNS [Box]; <> <<>> DoToPixelArray: PROC [ pa: PixelArray, proc: ValueProc, map: SampleMap ¬ NIL, clientData: REF ¬ NIL]; <> <<>> IntersectionOfPixelArrays: PROC [pa1, pa2, pa3, pa4: PixelArray ¬ NIL] RETURNS [Box]; <> <<>> SetPixelArrayRange: PROC [pa: PixelArray, box: Box]; <> <<>> CopyPixelArray: PROC [in: PixelArray] RETURNS [copy: PixelArray]; <> <> BoxFromXYWH: PROC [x, y, w, h: INTEGER] RETURNS [Box]; <> <<>> XYWHFromBox: PROC [box: Box] RETURNS [x, y, w, h: INTEGER]; <> <<>> RectangleFromXYs: PROC [x0, y0, x1, y1: INTEGER] RETURNS [Rectangle]; <> <<>> BoxFromRectangle: PROC [rectangle: Rectangle] RETURNS [Box]; <> <> DoWithSampleMapsFromContext: PROC [context: Context, action: PROC [maps: SampleMaps]]; <> <> <> <> <<>> ContextFromSampleMaps: PROC [maps: SampleMaps, ignoreColormap: BOOL ¬ FALSE] RETURNS [Context]; <> <> <<>> TransformContextToMap: PROC [context: Context, map: SampleMap]; <> <> PairFromMapCoords: PROC [x, y: INTEGER, map: SampleMap, fit: BOOL ¬ TRUE] RETURNS [RealPair]; <> <> MapCoordsFromPair: PROC [pair: RealPair, map: SampleMap, fit: BOOL ¬ TRUE] RETURNS [IntegerPair]; <> <> END.