Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1.chuqui 4/7/84; site apple.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!decwrl!sun!idi!apple!lsr From: lsr@apple.UUCP (Larry Rosenstein) Newsgroups: net.micro.mac Subject: Re: How does MacDraw use the PICT resource Message-ID: <23864@apple.UUCP> Date: Sun, 24-Feb-85 18:36:07 EST Article-I.D.: apple.23864 Posted: Sun Feb 24 18:36:07 1985 Date-Received: Wed, 27-Feb-85 07:35:55 EST References: Reply-To: lsr@apple.UUCP (Larry Rosenstein) Distribution: net Organization: Macintosh Division, Apple Computer Lines: 45 In article mnh@utcsri.UUCP (Mark N. Hume) asks about how MacDraw interprets PICT resources. PICT resources are just Quickdraw pictures; MacDraw uses this as its main Scrap format, because all application can use Quickdraw to read the picture. (MacDraw also can save documents in PICT format. This format consists of 512 bytes of header followed by a Quickdraw picture.) To convert a Quickdraw picture into an internal data structure is easy, and does not require any knowledge of how a picture is represented. All you do is replace the standard Quickdraw capture procs with your own special ones, and then draw the picture in that grafPort. For example, you would define a MyRect procedure that takes the same arguments as StdRect, and install it in the grafPort's capture procs. Then every time a rectangle appears in the picture, your procedure will be called. By examining the arguments you can determine the location of the rectangle and the kind of graphic operation (fill, paint, ...). By examining the grafPort you can determine the fill pattern, pen pattern, etc. The same approach applies to the other graphical shapes. (This is the technique usd by MacDraw itself.) You will be able to paste in graphical data from any application that uses pictures, not just MacDraw. MacDraw also uses picture comments to embed mre semantics in pictures. (I know that these are used in PICT documents, but I am not sure if they are also used for cutting and pasting.) An example of where these are used is rotated text. MacDraw inserts a bitmap for the rotated text so that any program that draws the picture gets the rotated text. It also inserts a picture comment with the actual text so that if a users un-rotates the text it can be edited normally. Comments are NOT used for simple objects, such as rectangles. If you try to read in a PICT file, note that it is not necessary to read the entire file into memory at once. There is a Quickdraw capture proc for reading bytes from a picture. Simple install your own procedure that reads bytes from the disk instead. Good luck. Larry Rosenstein {nsc, ios, dual, voder}!apple!lsr lsr@Apple.CSNET