mnh@utcsri.UUCP (Mark N. Hume) (02/21/85)
I am trying to determine the format of PICT resources and how MacDraw in particular picks apart the commands therein. I would like to take a PICT resource from MacDraw and use it in a program I am writing (mainly because for now, I don't want to have to write the drawing code myself). Does MacDraw use Picture comments to determine the objects in a PICT? When MacDraw does find out the pict structure, what kind of data structure does it store the objects in? Any ideas? Another question I have is whether there is an easy way of telling what objects a user has selected on the screen. So far the only way I have thought of is by comparing the point of selection (or rectangle of selection) to every single object (actually, the rectangle enclosing the object, since for now my objects cannot overlap). Is there a more intelligent (faster/easier) way. Thanks for any help, Mark Hume -- Mark N. Hume
cutter@apple.UUCP (Mark Cutter) (02/26/85)
In article <utcsri.791> mnh@utcsri.UUCP (Mark N. Hume) writes: >I am trying to determine the format of PICT resources and how MacDraw >in particular picks apart the commands therein. I would like to take >a PICT resource from MacDraw and use it in a program I am writing >(mainly because for now, I don't want to have to write the drawing >code myself). Does MacDraw use Picture comments to determine the >objects in a PICT? Yes, MacDraw uses picture comments extensively. The purpose of the PICT file format is to allow other programs to use MacDraw drawings without having to track the internal data structures. To parse a QuickDraw picture, you install yourself in the Quickdraw bottleneck procs, and then call DrawPicture. When your procs get called, you can build up a list of data structures in your own format, recording only the information that is relevant to you. I wrote a document describing the PICT format, and proposed it as a standard for graphics interchange. The laser printer driver will support it, in fact, this is what has been responsible for the hold up in releasing MacDraw. Apple wants to be sure that the laser printer interface is well designed and implemented. You should be able to get a copy of this document from Macintosh Technical support (not on the net). If there is sufficient interest, I will post it on the net. >When MacDraw does find out the pict structure, what kind of data >structure does it store the objects in? Any ideas? MacDraw internal data structures use 32 bit fixed point numbers along with 8 bytes of pen size, fill pattern, etc info. Smallest object size is 24 bytes on disk. Additional info is kept around in memory, double links, selection and undo info. >Another question I have is whether there is an easy way of telling >what objects a user has selected on the screen. So far the only way >I have thought of is by comparing the point of selection (or rectangle >of selection) to every single object (actually, the rectangle enclosing >the object, since for now my objects cannot overlap). Is there a more >intelligent (faster/easier) way. Bounding box test is the fastest form of elimination. Mark Cutter Author/Developer of LisaDraw and MacDraw Education Research Group Apple Computer Inc. UUCP: {ucbvax!mtxinu, nsc, dual, idi, voder}!apple!cutter CSNET: cutter%apple@CSNET-RELAY ARPAnet: cutter@apple.ARPA -- Mark Cutter Education Research Group Apple Computer Inc. UUCP: {ucbvax!mtxinu, nsc, dual, idi, voder}!apple!cutter CSNET: cutter%apple@CSNET-RELAY ARPAnet: cutter@apple.ARPA