Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!nuchat!buster!brain!root From: root@brain.UUCP (Chuck Shotton) Newsgroups: comp.sys.mac.programmer Subject: Re: Converting PICT's Message-ID: <209@brain.UUCP> Date: 10 Feb 90 23:59:38 GMT References: <1082@metasoft.UUCP> Organization: BIAP Systems Lines: 34 rln@metasoft.UUCP (Roberta Norin) writes: >I am trying to read the contents of a PICT and convert the data to my >own format. I have noticed other applications doing this. In my first >attempt I just used the documentation on PICT opcodes and processed >through pointer to the picture data. As you guessed, Apple says playing with PICT opcodes is naughty. >This worked but documentation seems to indicate that you should not do >this. So I installed my own StdPutPic procedure, opened a new >picture, drew the picture, and then closed and killed the new picture. >Is this a legitimate approach? StdPutPic just gives you raw PICT opcode data. This is not the way to do it if you want to write in your own format. You need to patch ALL of the GrafProcs to point to your own routines. Here's what you do..... 1) Create a PICT somehow (OpenPicture, read a resource, whatever....). 2) Patch the standard drawing procedures StdRect, StdPoly, etc. using the GrafProcs data structure to point to YOUR routines instead of the ones supplied by QuickDraw. 3) For each routine you supply, take the arguments sent to you by QuickDraw, translate the particular object or drawing command into your own format and the write it out. 4) Call DrawPicture to "play back" the picture for your routines to write out. This approach avoids having to have ANY knowledge whatsoever about the format of PICTs or PICT opcodes. That way, Apple can come up with PICT 3 or something and your program won't break. Chuck Shotton cshotton@girch1.hsch.utexas.edu ...!buster!brain!root