carrier@cogsci.ucsd.EDU (Mark Carrier) (10/12/89)
Does anybody have or know where to find the format of the Scrapbook File? The reason I ask is that I would like to be able to take a set of many PICT resources (cut from various graphics applications) and one-by-one convert them to a format suitable for use on a PC. I've already got the conversion code working properly, but I now have the problem of having to apply my Mac code to each image individually, invoking my application each time. If I knew the format of the scrapbook file (all the images are contained in scrapbook files) then I could just start the whole process off and leave it to do each conversion automatically. Thanks in advance. Mark Carrier carrier@cogsci.ucsd.edu
pepke@loligo (Eric Pepke) (10/12/89)
The scrapbook is a bunch of resources and an SMAP to map all the resources in the right order. If you don't care about the order, you can just open the scrapbook as a resource file and use ordinary resource manager calls to get all the resources of a certain type. Eric Pepke INTERNET: pepke@gw.scri.fsu.edu Supercomputer Computations Research Institute MFENET: pepke@fsu Florida State University SPAN: scri::pepke Tallahassee, FL 32306-4052 BITNET: pepke@fsu Disclaimer: My employers seldom even LISTEN to my opinions. Meta-disclaimer: Any society that needs disclaimers has too many lawyers.
stores@unix.SRI.COM (Matt Mora) (10/12/89)
In article <785@cogsci.ucsd.EDU> carrier@cogsci.ucsd.edu (Mark Carrier) writes: > >Does anybody have or know where to find the format of the Scrapbook >File? The reason I ask is that I would like to be able to take a set >of many PICT resources (cut from various graphics applications) and >one-by-one convert them to a format suitable for use on a PC. I've >already got the conversion code working properly, but I now have the >problem of having to apply my Mac code to each image individually, >invoking my application each time. If I knew the format of the scrapbook >file (all the images are contained in scrapbook files) then I could >just start the whole process off and leave it to do each conversion >automatically. >Thanks in advance. >Mark Carrier >carrier@cogsci.ucsd.edu I don't realy know the format of the scrapbook file, but if its just PICT's that you want, that's easy. If look at the scrapbook file with resedit you see that it has a bunch of resources, PICT being one of them. If you open the PICT resource you can see a list of them. To get these out without knowing there Id numbers, you can use the rom call Get1IndResource (GetIndResource if you have 64K roms). This will give you a handle to the e PICTs. Count1Resources will return the number of the resource type that you specified. Loop and call Get1IndResource each time through the loop to get a handle to the next pict in the file. Below is some Ugly pseudo pseudocode. ref:=OpenResFile('scrapbook'); {open scrapbookfile} index:=Count1Resources('PICT'); {find out how many there are} for i=1 to index do begin myPicthandle:=Get1IndResource(rType, index); {get the next PICT} {do your conversion} DisposHandle(myPicthandle); end; CloseResFile(ref); end. -- ___________________________________________________________ Matthew Mora SRI International stores@unix.sri.com ___________________________________________________________
majeske@zodiac.rutgers.edu (10/18/89)
If this suceeds it will be my first posting. The format of the scrapbook file is very simple; the data fork is empty, 'pages' are placed in the resource file sequentially as they are pasted in. The ordering between resource types is kept by the SMAP resource, the body of which is simply 255 bytes; the first gives the page number of the first resource of the first type, the second of the first type second resource and so on. I would think that you could safely ignore the SMAP though, just opening the resource file and sequentially fetching whatever (PICT I presume) will give you the pictures in the sequence they were pasted. I wrote a utilty for Microcomm a few months back that dealt with scrapbook files, craftily reserving the rights; if your interested I'll send you the source.