[comp.sys.mac] Resource Creation

lipsett@inmet.UUCP (09/25/87)

Two resource questions:

1.  How can one use ResEdit to create a resource of a given type *with
a particular resource ID*?  It really seems to want to give it its own
random ID.

2.  How can one create a PICT resource (graphically would be nice; if
not, how does the internal format of a PICT resource differ from what
one might write into a file from an application that uses the
QuickDraw picture routines to create same)?

Thanks in advance for answering a question to which the answer is
probably obvious...

Roger Lipsett
{ihnp4, mirror}!inmet!lipsett

stew@endor.harvard.edu (Stew Rubenstein) (09/27/87)

In article <127200006@inmet> lipsett@inmet.UUCP writes:
>
>Two resource questions:
>
>1.  How can one use ResEdit to create a resource of a given type *with
>a particular resource ID*?  It really seems to want to give it its own
>random ID.

Let it get a random ID, and then change the ID to what you want with
the Get Info command.

>2.  How can one create a PICT resource (graphically would be nice; if
>not, how does the internal format of a PICT resource differ from what
>one might write into a file from an application that uses the
>QuickDraw picture routines to create same)?

The easiest way to get PICTs is to create them with whatever program you
want: SuperPaint, MacDraw, whatever; copy them to the clipboard, and
paste them into the scrapbook.  Then you can open up the ScrapBook in
ResEdit, and copy the PICTs out and into whatever you want.

The PICT file format is documented in Tech Note 27.  In a nutshell,
it's a 512 byte header (which may be written as all zeroes) followed
by a normal QuickDraw PICT.

Stew Rubenstein
Cambridge Scientific Computing, Inc.
UUCPnet:    seismo!harvard!rubenstein            CompuServe: 76525,421
Internet:   rubenstein@harvard.harvard.edu       MCIMail:    CSC

singer@endor.harvard.edu (Andrew Singer) (09/28/87)

After creating the resource, choose Get Info (or press command-I) and set
the resource ID in the info box.

		--Rich


**The opinions stated herein are my own opinions and do not necessarily
represent the policies or opinions of my employer (THINK Technologies, Inc).

Richard M. Siegel
Customer Support Representative
THINK Technologies, Inc.

Uucp: {decvax, ucbvax, sun}!harvard!endor!singer
Internet/Arpanet: singer@harvard.harvard.edu

No one writes programs that work right the first time. If they did,
I'd be out of a job.

briand@tekig4.TEK.COM (Brian Diehm) (09/28/87)

>1.  How can one use ResEdit to create a resource of a given type *with
>a particular resource ID*?

You can select (but not open) an existing resource, then Get Info from the
file menu.  This brings up a dialog box that allows you to renumber the
resource, as well as mark the purgable, etc. properties.  A get info on a
file allows similar setting of creator, type, and finder flags.

>2.  How can one create a PICT resource (graphically would be nice

MacDraw is one way.  The Save As dialog box allows the setting of the file
format, of which PICT is an option.  You then are creating a file with a PICT
resource in it.

-- 
-Brian Diehm     (SDA - Standard Disclaimers Apply)
Tektronix, Inc.
briand@tekig4.TEK.COM   or  {decvax,cae780,uw-beaver}!tektronix!tekig4!briand  

earleh@dartvax.UUCP (09/29/87)

In article <127200006@inmet>, lipsett@inmet.UUCP writes:
-> 
-> Two resource questions:
-> 
-> 1.  How can one use ResEdit to create a resource of a given type *with
-> a particular resource ID*?  It really seems to want to give it its own
-> random ID.

I don't know.  I think it's part of an attempt to create non-conflicting
resource IDs.
-> 
-> 2.  How can one create a PICT resource (graphically would be nice; if
-> not, how does the internal format of a PICT resource differ from what
-> one might write into a file from an application that uses the
-> QuickDraw picture routines to create same)?
-> 
If you want to quickly create a PICT resource, then "Copy" a picture
from MacPaint or MacDraw or something, and "Paste" the thing into the
ScrapBook.  You can get the 'PICT' out of the ScrapBook using ResEdit.
You still have to put up with the funny ID, however.

Earle

-- 
*********************************************************************
*Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755   *
*********************************************************************

oster@dewey.soe.berkeley.edu.UUCP (09/30/87)

In article <1978@tekig4.TEK.COM> briand@tekig4.UUCP (Brian Diehm) writes:
>>2.  How can one create a PICT resource (graphically would be nice
>MacDraw is one way.  The Save As dialog box allows the setting of the file
>format, of which PICT is an option.  You then are creating a file with a PICT
>resource in it.

This is true, but very misleading. When you Save As PICT in MacDraw,
you create a file with a 512 byte header followed by the contents of a
PICT resource as data. To use it as a resource, you'd have to allocate
a handle, lock the handle, FSRead the data into the handle, then do an
AttachResource.  It is much, much easier to just select a piece of a
MacDraw document and hit "Copy". This puts the graphics onto the
clipboard as a PICT resource, that can be pasted into a file in
ResEdit directly, with no intermediate steps.  (If you want to do a
lot of them, just paste them to the ScrapBook, then open "ScrapBook
File" from inside ResEdit.)