<> <> DIRECTORY AIS, Graphics, GraphicsOps, IO, Rope; BMToAIS: PROGRAM IMPORTS AIS, Graphics, GraphicsOps, Rope = BEGIN ROPE: TYPE = Rope.ROPE; Bitmap: TYPE = GraphicsOps.BitmapRef; fRef: AIS.FRef; w: AIS.WRef; raster: AIS.Raster _ NEW [AIS.RasterPart]; Write: PROC [fileName: ROPE, bm: Bitmap, bitsPerPixel: CARDINAL] = BEGIN raster^ _ [ scanCount: bm.height, scanLength: bm.width, scanMode: rd, bitsPerPixel: bitsPerPixel, linesPerBlock: -1, paddingPerBlock: 0]; fRef _ AIS.CreateFile[name: fileName, raster: raster]; w _ AIS.OpenWindow[f: fRef]; FOR line: INTEGER IN [0 .. INTEGER[bm.height]) DO TRUSTED { AIS.UnsafeWriteLine[ w: w, buffer: [ length--in words, right?--: bm.raster, addr: LOOPHOLE[bm.base, LONG POINTER] + LONG[bm.raster]*line], line: line]}; ENDLOOP; AIS.CloseWindow[w]; AIS.CloseFile[fRef]; END; WriteEyes: PROC [prefix: ROPE, allEyes: Bitmap, size, upset: INTEGER] = BEGIN DoIt: PROC [view: ROPE, pos: INTEGER] = BEGIN GraphicsOps.DrawBitmap[self: context, bitmap: allEyes, w: 64, h: 64, x: pos*64, y: 0, xorigin: pos*64, yorigin: 64]; Write[prefix.Cat[view, ".AIS"], single, 0]; END; single: Bitmap _ GraphicsOps.NewBitmap[size, size]; context: Graphics.Context _ GraphicsOps.NewContextFromBitmap[single]; Graphics.SetCP[context, (size-64)/2, upset]; DoIt["Left", 0]; DoIt["Right", 1]; DoIt["Back", 2]; DoIt["Front", 3]; END; END.