RawEye.Mesa
Last Edited by: Spreitzer, January 12, 1984 9:00 pm
DIRECTORY FS, GraphicsOps, IO, Rope;
RawEye: CEDAR PROGRAM
IMPORTS FS, GraphicsOps, IO =
BEGIN
ROPE: TYPE = Rope.ROPE;
Bitmap: TYPE = GraphicsOps.BitmapRef;
ReadBitmap: PROC [fileName: ROPE, byteLength, wordWidth: NAT] RETURNS [bm: Bitmap] =
BEGIN
file: IO.STREAMFS.StreamOpen[fileName: fileName, streamOptions: bmStreamOptions];
bitWidth: NAT ← wordWidth*16;
bitHeight: NAT ← byteLength*8/bitWidth;
wp: LONG POINTER TO CARDINAL;
bm ← GraphicsOps.NewBitmap[bitWidth, bitHeight];
TRUSTED {wp ← LOOPHOLE[bm.base]};
FOR row: CARDINAL IN [0 .. bitHeight) DO
FOR col: CARDINAL IN [0 .. wordWidth) DO
word: CARDINAL ← ReadWord[file];
TRUSTED {wp^ ← word; wp ← wp + 1};
ENDLOOP;
ENDLOOP;
file.Close[];
END;
ReadWord: PROC [file: IO.STREAM] RETURNS [word: CARDINAL] =
BEGIN
word ← file.GetChar[] - 0C;
word ← word*256 + (file.GetChar[] - 0C);
END;
bmStreamOptions: FS.StreamOptions ← FS.defaultStreamOptions;
bmStreamOptions[tiogaRead] ← FALSE;
END.