OBRIEN%OBRIEN@VENUS.YCC.YALE.EDU ("James A. O'Brien 432-4382", 203) (09/02/88)
Regarding the recent messages to INFO-DEC-MICRO about the Macintosh .MEM file viewer: I am the one who wrote it, and got the pictures converted. The following is a brief description of how it was done. It is an excerpt of a private message I once sent to a user who expressed an interest in the technique. ________________ Firstly, if 'MACPIX' (wherever it picked up the name) is what I THINK it is, then I can maybe help - I wrote it!!!! The pictures I did were, e.g. Boy George, a fake MAC screen, a map of the US, a map of Ireland (my homeland) etc. The process of making the .MEM files from the MAC pictures was tortuous. On the MAC: 1) Get the picture into the clipboard. 2) Write e.g. a MAC BASIC program to read the clipboard (or at least an i x j piece of it), and write out the bitmap one sixteen-bit integer at a time in ASCII format, one per line, scanning the bitmap row by row until done. The first two lines in the output file should be i and j, the width and height in pixels of the image. Obviously, i < 384 and j < 240, to have the picture fit on the Rainbow medium resolution (square pixel) mode. You're on your own for these steps - I'm not a MAC person. Incidentally, the pictures that ended up being distributed came from a variety of sources, e.g. clip art collections for the MAC; photographs digitized using ThunderScan, etc. 3) Get the ASCII file onto your Rainbow. (e.g null modem direct connection, or put it on your VAX first, etc. - I used a null modem cable.) On the Rainbow: 4) I have programs which (a) massage the integers into the correct form and (b) read them into GWBASIC, make a picture in memory and save as a .MEM file. (reading pictures from ASCII integer representations of the bitmap takes several minutes!) I'd be happy to give you the listings (one is in TurboPascal and the other in GWBASIC). 5) Finally, you view them in the usual manner. _______________________________ 9/2/88 These are the programs. Here are a) BYTESWAP.PAS to byte- reverse the ASCII integers from the MAC b) SAVEPIC.BAS to read the ASCII bitmap and create and save a .MEM memory image file and c) LOADPIC.BAS, an enhanced version of the .MEM file viewer you already have. Jim O'Brien Department of Chemical Engineering Yale University 2159 Yale Station New Haven, CT 06520, U.S.A. +1 203 432 4382 (days) +1 203 322 7222 (eves) Return Addresses (both equivalent): OBRIEN%OBRIEN@YALEVMS BITNET OBRIEN%OBRIEN@VENUS.YCC.YALE.EDU Internet |--+-| |--+-| |-------+--------| | | | | | +--------| host network address | +--------| microvax node name +---------| userid on microvax --------------------------BYTESWAP.PAS {Program to process byte-reversed Macintosh bitmaps. Need integers in byte-reversed format for the Rainbow BASIC program. Run this program on the ASCII file before running SAVEPIC.BAS usage : swapbyte infile outfile Code is Turbo Pascal V3.01A, should run under 4.0 } var infile, outfile : text; i : integer; begin if (paramcount <> 2) then begin writeln('***ERROR*** Must specify two and only two arguments'); end else begin assign(infile, paramstr(1)); assign(outfile, paramstr(2)); reset(infile); rewrite(outfile); { first two entries are the size-bytes - reproduce them w/o changes } readln(infile, i); writeln(outfile, i); readln(infile, i); writeln(outfile, i); { now step through infile, swap bytes and output to outfile } while (not eof(infile)) do begin readln(infile, i); i := swap(i); writeln(outfile, i); end; { close files, print message and end } close(infile); close(outfile); writeln; writeln('Byte-swapping procedure completed'); writeln('Output file is ', paramstr(2)); end; end. --------------------------end of BYTESWAP.PAS----------------- ----------------------SAVEPIC.BAS 1 REM ******************************************************** 2 REM 10 REM PROGRAM TO PROCESS PICTURES STORED FROM MACINTOSH BITMAP 15 REM DATA IN ASCII FORMAT, AND SAVE IN .MEM FORMAT 16 REM 20 REM ******************************************************** 21 REM 22 REM COPYRIGHT (C) JAMES A. O'BRIEN, 1985,6,7 23 REM 1166 HOPE ST. #6 24 REM STAMFORD, CT 06907 25 REM 26 REM 27 REM ********************************************************* 30 REM 40 REM MODIFY PALETTE TO SHOW ALL PLANES 50 REM 60 DEF SEG 70 SCREEN 1 80 KEY OFF 90 REM 100 CLEAR : PALETTE 110 DEFINT A-Z 120 ISCAN = 240 130 IBYTESWIDE = 48 140 ITOTALBYTES = 4 + IBYTESWIDE*ISCAN*2 150 IELEMENTS = ITOTALBYTES 160 DIM A(IELEMENTS) 170 CLS 180 INPUT "ENTER ASCII BITMAP FILENAME ", FILENAME$ 190 INPUT "ENTER PICTURE FILENAME ", PICTUREFILE$ 200 CLS 210 OPEN FILENAME$ FOR INPUT AS #5 220 PRINT "BEGINNING READ OF BITMAP FROM FILE . . . . " 230 INPUT#5, A(0) : INPUT#5, A(1) 240 DATAIN = 0 250 FOR I = 2 TO A(0)*A(1)/16 + 1 260 INPUT#5, DATAIN% 270 A(I) = DATAIN 280 NEXT I 290 REM 300 REM ALL MACINTOSH DATA IS IN PLANE 1 310 REM SET THAT PLANES COLOR TO HIGH 320 REM 330 PALETTE 0, &H0 340 PALETTE 1, &HFFF 350 CLS 360 PUT(0,0), A, PSET 370 CLOSE#5 380 REM 390 REM NOW, PICTURE IS ON SCREEN 400 REM BSAVE IT TO DISK 410 POINTER = VARPTR(A(0)) 420 BSAVE PICTUREFILE$, POINTER, ITOTALBYTES/2 430 CLS 440 POINTER = VARPTR(A(0)) 450 BLOAD PICTUREFILE$, POINTER 460 PUT (0,0), A, PSET 470 GOTO 470 ----------------------------------end of SAVEPIC.BAS ------------------------------LOADPIC.BAS 10 REM **************************************************************** 20 REM 30 REM PROGRAM TO BLOAD PICTURE STORED AS MEMORY IMAGE FILE 40 REM USES .MEM MEMORY MAP PICTURES 50 REM 60 REM **************************************************************** 70 REM 80 REM COPYRIGHT (C) JAMES A. O'BRIEN, 1985,6,7 90 REM 1166 HOPE ST. #6 100 REM STAMFORD, CT 06907 110 REM 120 REM ***************************************************************** 130 REM MODIFY PALETTE TO SHOW ALL PLANES 140 REM 150 DEF SEG 160 SCREEN 1 170 KEY OFF 180 REM 190 CLEAR : PALETTE 200 DEFINT A-Z 210 ISCAN = 240 220 IBYTESWIDE = 48 230 ITOTALBYTES = 4 + IBYTESWIDE*ISCAN*2 240 IELEMENTS = ITOTALBYTES 250 DIM A(IELEMENTS) 260 CLS 270 INPUT "ENTER PICTURE FILENAME (.MEM) > ", PICTUREFILE$ 280 PICTUREFILE$ = PICTUREFILE$ + ".MEM" 290 REM EXIT GRACEFULLY FROM A 'FILE NOT FOUND' ERROR 300 ON ERROR GOTO 420 310 CLS 320 POINTER = VARPTR(A(0)) 330 PALETTE 0, &HFF8 'SAME AS MAC 340 PALETTE 1, &HFF2 350 COLOR 0,1 360 BLOAD PICTUREFILE$, POINTER 370 PUT (0,0), A, PSET 380 COLOR 15,1 'CHANGE TO 15,0 FOR REVERRUN 390 IF NOT INKEY$= " " THEN GOTO 390 400 PRNTSTRNG$ = "" : GOTO 430 410 REM FINALLY, CHANGE BACK PALETTE 420 PRNTSTRNG$ = "NO SUCH FILE - TRY AGAIN" 430 PALETTE : COLOR 15,0 440 PRINT PRNTSTRNG$ : ON ERROR GOTO 0 : END -----------------------------------end of LOADPIC.BAS