-- JaMSnapImpl.mesa
-- Last changed by Doug Wyatt, January 7, 1981 6:07 PM
DIRECTORY
AltoDevice USING [Bitmap, ScreenBitmap],
Blt USING [Handle, New, Source, SetBox, Rect],
JaMFnsDefs USING [Register, PopString],
JaMGraphicsDefs USING [GetDC],
JaMSnapDefs USING [],
PressDefs USING [PressFileDescriptor, InitPressFileDescriptor,
PutComputedDots, ClosePressFile];
JaMSnapImpl: PROGRAM
IMPORTS AltoDevice, Blt, JaMFnsDefs, JaMGraphicsDefs, PressDefs
EXPORTS JaMSnapDefs = {
pfd: PressDefs.PressFileDescriptor;
linew: CARDINAL = 40;
line: ARRAY[0..linew) OF WORD;
bb: Blt.Handle ← Blt.New[@line,linew];
JSnap: PROCEDURE = {
bm: AltoDevice.Bitmap ← AltoDevice.ScreenBitmap[];
w: CARDINAL ← 16*bm.raster;
h: CARDINAL ← bm.height;
y: CARDINAL←0;
NextScanLine: PROCEDURE RETURNS[POINTER] = {
Blt.Rect[bb];
bb.sdy←bb.sdy-1;
RETURN[@line];
};
filename: STRING ← [100];
JaMFnsDefs.PopString[filename];
Blt.Source[bb,bm.base,bm.raster];
Blt.SetBox[bb,0,0,w,1];
PressDefs.InitPressFileDescriptor[@pfd,filename];
PressDefs.PutComputedDots[p: @pfd, x: 2540, y: 25400,
nPixels: w, nScanLines: h, bitsPerPixel: 0,
width: 32*w, height: 32*h, nextScanLine: NextScanLine];
PressDefs.ClosePressFile[@pfd];
};
[]←JaMGraphicsDefs.GetDC[]; -- to make sure it’s started
JaMFnsDefs.Register[".snap",JSnap];
}.