[comp.sys.mac.programmer] Writing PICS files....

smd@media-lab.media.mit.edu (Steven Drucker) (03/21/91)

	I have an application that can generate 3d animations but now
I'd like to save out the frames as a PICS file so that other
viewing programs can use it.  The only problem is, I don't know
how to do that.
	I think that a PICS file is just a series of PICT resources
but whenever I've tried to open the resource file and then use
addresource for the picthandle that I've created, my program crashes.
Does anybody know the proper way to create a PICS file (or even
create PICT resources in a file)? (I've been using THINK C 4.0 but
any example code would be very helpful)
Thanks,
-Steve Drucker

mab@ecmwf.co.uk (Baudouin Raoult) (03/25/91)

In article <SMD.91Mar20145535@media-lab.media.mit.edu>, smd@media-lab.media.mit.edu (Steven Drucker) writes:
> 
> 	I have an application that can generate 3d animations but now
> I'd like to save out the frames as a PICS file so that other
> viewing programs can use it.  The only problem is, I don't know
> how to do that.
> 	I think that a PICS file is just a series of PICT resources
> but whenever I've tried to open the resource file and then use
> addresource for the picthandle that I've created, my program crashes.
> Does anybody know the proper way to create a PICS file (or even
> create PICT resources in a file)? (I've been using THINK C 4.0 but
> any example code would be very helpful)
> Thanks,
> -Steve Drucker


You must be calling KillPicture some time after AddResouce. If you call AddResource, the handle added *belongs* to the Resource Manager ( it will be disposed if you close the resource file).

Write:

	AddResource(Handle(myPic),.....);
	WriteResource(Handle(myPic));
	UpdateResFile(CurrResFile);  
	DetachResource(Handle(myPic)); /* get control back of your picture */
	KillPicture(myPic);

-- 

---------------------------------------------------
Baudouin Raoult. 
European Center for Medium Range Weather Forecast
Reading, UK
---------------------------------------------------