-- TJaMImageImpl.mesa
-- Last changed by Bill Paxton, March 12, 1982 8:35 am
-- Last changed by Doug Wyatt, September 13, 1982 1:21 pm
-- Last Edited by: Stone, March 17, 1983 7:31 pm
DIRECTORY
Graphics,
GraphicsBasic,
GraphicsOps,
JaMOps,
JaMInternal,
JaMFnsDefs,
Rope USING [ROPE],
ConvertUnsafe,
Real,
TJaMGraphics;
TJaMImageImpl: PROGRAM
IMPORTS Graphics,
GraphicsOps,
JaMFnsDefs,
JaMOps,
ConvertUnsafe,
Real,
TJaMGraphics = {
JDrawImage: PROCEDURE [frame: JaMInternal.Frame] = {
Draw: PROC [dc: Graphics.Context] = { Graphics.DrawImage[dc,image] };
str: STRING ← [100];
name: Rope.ROPE;
image: GraphicsBasic.ImageRef;
JaMFnsDefs.PopString[str];
name ← ConvertUnsafe.ToRope[str];
image ← GraphicsOps.NewAisImage[name];
TJaMGraphics.Painter[Draw, frame];
};
JCopyScreen: PROCEDURE [frame: JaMInternal.Frame] = {
Get: PROC RETURNS [CARDINAL] = {
RETURN [Real.RoundC[MAX[JaMOps.PopReal[frame.opstk],0.0]]] };
y2: CARDINAL ← Get[];
x2: CARDINAL ← Get[];
y1: CARDINAL ← Get[];
x1: CARDINAL ← Get[];
Copy: PROC [dc: Graphics.Context] = {
GraphicsOps.DrawBitmap[
self: dc,
bitmap: GraphicsOps.ScreenBitmap[],
w: x2-x1,
h: y2-y1,
x: x1,
y: y1,
xorigin: (x1+x2)/2,
yorigin: (y1+y2)/2
] };
IF x1 > x2 THEN { temp: CARDINAL ← x1; x1 ← x2; x2 ← temp };
IF y1 > y2 THEN { temp: CARDINAL ← y1; y1 ← y2; y2 ← temp };
TJaMGraphics.Painter[Copy, frame];
};
JaMOps.RegisterExplicit[JaMOps.defaultFrame,".drawimage"L,JDrawImage];
JaMOps.RegisterExplicit[JaMOps.defaultFrame,".copyscreen"L,JCopyScreen];
}...