sas@giza.cis.ohio-state.edu (Scott Sutherland) (03/21/91)
Regarding spooling a picture to a file, Inside Mac V, p. 89 gives an example
that includes the following var and a procedure that replaces the standard
PutPicProc and does the actual spooling to disk:
--------------------------------------------------------
var
PICTcount: Longint; {the current size of the picture}
...
procedure PutPICTData;
var
longCount: Longint;
err: Integer;
begin
longCount := byteCount;
PICTcount := PICTcount + byteCount;
err := FSWrite(globalRef, longCount, dataPtr);
if newPICThand <> nil then
newPictHand^^.picSize := PICTcount;
end;
--------------------------------------------------------
Playing around with it, I found that it does not work when the size of the
PICT is greater than 32K. This is so because in the following line:
newPictHand^^.picSize := PICTcount;
PICTcount will end up being greater than 32000, and so newPictHand^^.picSize
will overflow because it is an integer.
To fix it, I changed the line to :
newPictHand^^.picSize := LoWord(PICTcount);
and it seems to work fine since according to IM V-87, picSize is the low
order 16 bits of the picture size in version 2 pictures. The REAL question
is whether I've overlooked anything? Anyone had to deal with this?
Thanks in advance,
Scott
---
Scott A. Sutherland Internet:scott@dance.ohio-state.edu; AT&T Mail:!scottas
Staff Macintosh Developer Phone: 614/292-7977; Fax 614/292-0939
The Ohio State University, Department of Dance