campoly@violet.berkeley.edu (Mr. Science) (10/20/87)
Thanks to all who responded to my query about decoding PICT files. Here is an outline of the recommended method: 1) Read Inside Mac, Vol I, pp 197-200. The section on Customizing QuickDraw Operations describes the low-level bottleneck procedures which QuickDraw uses to perfom its basic graphic operations. There are separate procedures for drawing lines, rectangles, etc. 2) Call SetStdProcs to get a QDProcs record which contains pointers to the built-in bottleneck routines. You can then change one or more of these pointers to point to your own routines. You must also set the grafProcs field of the grafPort you wish to use for drawing to point this QDProcs record. 3) The parameters to these bottleneck routines pass all the information needed to draw a specific object. Your personal routines may perform any desired operations on these parameters (such as storing them for later reference or modifying them), then, if you wish to actually draw the object, your routine can call the corresponding built-in routine. 4) Once you have everything set up, call DrawPicture with the handle to the PICTure. For example, in Pascal: myProcsPtr := QDProcsPtr(NewPtr(Sizeof(QDProcs))); SetStdProcs(myProcsPtr^); myProcsPtr^.lineProc := @MyLineProc; thePort^.grafProcs := myProcsPtr; DrawPicture (thePicHandle, thePicFrame); The procedrue MyLineProc will be called whenever a line drawing command is encountered in the PICTure whose handle is thePicHandle. NOTE: Parsing PICT files directly is *not* a good idea. There are serious difficulties with this approach, not the least of which is lack of compatibility with MAC II's (and color QuickDraw). Once again, a BIG thank you to all who took the time to enlighten me. Gregory Dow ARPA: campoly@violet.berkeley.edu Chemical Engineering Dept. UUCP: {uwvax, decvax, ihnp4, ...}!ucbvax University of California !campoly%violet.berkeley.edu Berkeley, CA 94720 BITNET: POLYDOW@UCBCMSA