home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14531 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  2.0 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!malgudi.oar.net!uoft02.utoledo.edu!desire.wright.edu!jmatthews
  2. Newsgroups: comp.sys.mac.programmer
  3. Subject: Re: How to save a PICT file?
  4. Message-ID: <1992Aug26.000749.3750@desire.wright.edu>
  5. From: jmatthews@desire.wright.edu
  6. Date: 26 Aug 92 00:07:49 EST
  7. References: <5hnyk1d@rpi.edu>
  8. Distribution: usa
  9. Organization: Wright State University 
  10. Lines: 42
  11.  
  12. In article <5hnyk1d@rpi.edu>, raffuj@aix.rpi.edu (Jose A. Raffucci) writes:
  13. > I've gotten to the point where the file is created, and I have
  14. > a handle to a PICT, but I'm really not sure about the header, 
  15. > and just what parameters to use with FSWrite().
  16.  
  17.   procedure DoSavePICT (picHdl: PicHandle);
  18.     var
  19.       reply: SFReply;
  20.       getDlgTH: DialogTHndl;
  21.       r: Rect;
  22.       index, fRefNum: Integer;
  23.       count: LongInt;
  24.       buffer: array[0..127] of LongInt;
  25.  
  26.   begin
  27.     getDlgTH := DialogTHndl(GetResource('DLOG', putDlgID));
  28.     r := getDlgTH^^.boundsRect;
  29.     CenterRect(ScreenRect, r);
  30.     SFPutFile(r.topLeft, ResStr(savePictID), '', nil, reply);
  31.     if reply.good then
  32.       begin
  33.         for index := 0 to 127 do {empty 512 byte PICT header}
  34.           buffer[index] := 0;
  35.         ErrorCheck(FSDelete(reply.fName, reply.vRefNum));
  36.         ErrCheck(Create(reply.fName, reply.vRefNum, 'Bozo', 'PICT'));
  37.         ErrCheck(FSOpen(reply.fName, reply.vRefNum, fRefNum));
  38.         count := SizeOf(buffer);
  39.         ErrCheck(FSWrite(fRefNum, count, @buffer));
  40.         count := GetHandleSize(Handle(picHdl));
  41.         ErrCheck(FSWrite(fRefNum, count, Ptr(picHdl^)));
  42.         ErrCheck(FSCLose(fRefNum));
  43.       end
  44.   end;
  45.  
  46. CenterRect, ScreenRect, ResStr and ErrCheck are auxilliary routines.
  47. 'Bozo' is the creator for Giffer documents.
  48.  
  49. Hope this helps.
  50. o----------------------------------------------------------------------------o
  51. | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
  52. | "I'm a commensal .sig virus, indistinguishable from an ordinary organelle."|
  53. o----------------------------------------------------------------------------o
  54.