home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!malgudi.oar.net!uoft02.utoledo.edu!desire.wright.edu!jmatthews
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: How to save a PICT file?
- Message-ID: <1992Aug26.000749.3750@desire.wright.edu>
- From: jmatthews@desire.wright.edu
- Date: 26 Aug 92 00:07:49 EST
- References: <5hnyk1d@rpi.edu>
- Distribution: usa
- Organization: Wright State University
- Lines: 42
-
- In article <5hnyk1d@rpi.edu>, raffuj@aix.rpi.edu (Jose A. Raffucci) writes:
- > I've gotten to the point where the file is created, and I have
- > a handle to a PICT, but I'm really not sure about the header,
- > and just what parameters to use with FSWrite().
-
- procedure DoSavePICT (picHdl: PicHandle);
- var
- reply: SFReply;
- getDlgTH: DialogTHndl;
- r: Rect;
- index, fRefNum: Integer;
- count: LongInt;
- buffer: array[0..127] of LongInt;
-
- begin
- getDlgTH := DialogTHndl(GetResource('DLOG', putDlgID));
- r := getDlgTH^^.boundsRect;
- CenterRect(ScreenRect, r);
- SFPutFile(r.topLeft, ResStr(savePictID), '', nil, reply);
- if reply.good then
- begin
- for index := 0 to 127 do {empty 512 byte PICT header}
- buffer[index] := 0;
- ErrorCheck(FSDelete(reply.fName, reply.vRefNum));
- ErrCheck(Create(reply.fName, reply.vRefNum, 'Bozo', 'PICT'));
- ErrCheck(FSOpen(reply.fName, reply.vRefNum, fRefNum));
- count := SizeOf(buffer);
- ErrCheck(FSWrite(fRefNum, count, @buffer));
- count := GetHandleSize(Handle(picHdl));
- ErrCheck(FSWrite(fRefNum, count, Ptr(picHdl^)));
- ErrCheck(FSCLose(fRefNum));
- end
- end;
-
- CenterRect, ScreenRect, ResStr and ErrCheck are auxilliary routines.
- 'Bozo' is the creator for Giffer documents.
-
- Hope this helps.
- o----------------------------------------------------------------------------o
- | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
- | "I'm a commensal .sig virus, indistinguishable from an ordinary organelle."|
- o----------------------------------------------------------------------------o
-