t-benw@microsoft.UUCP (Benjamin Waldmin) (06/30/88)
A friend of mine is having a problem (which I remember reading about on the net a while ago, although I forgot the solution). He's reading in a picture from a PICT file (yes, and skipping th 512 byte header), finding out its bounding rect, using OffsetRect, and using DrawPicture to draw the picture in the new rect. The problem is that nothing is printing out. He's drawing to a printer, and is using ClipRect before the DrawPicture to set the clipping region to the entire page (rPage). Does the picture have info about its own clipping region that is conflicting with the new one? Thanks, Ben Waldman !uw-beaver!microsoft!t-benw
kaufman@polya.Stanford.EDU (Marc T. Kaufman) (06/30/88)
In article <1578@microsoft.UUCP> t-benw@forward.UUCP (Benjamin Waldman) writes: >He's reading in a picture from a PICT file (yes, and skipping th 512 >byte header), finding out its bounding rect, using OffsetRect, and >using DrawPicture to draw the picture in the new rect. The problem is that >nothing is printing out. >He's drawing to a printer, and is using ClipRect before the DrawPicture >to set the clipping region to the entire page (rPage). Does the picture >have info about its own clipping region that is conflicting with the new >one? Yes, the PICT files (may) have clipping. However, drawing from a PICT file is a lot like copybits... the entire PICT (as defined by the bounding rect) is scaled and translated to fit into the dstRect specified by the DrawPicture call. The clipping region he specifies should encompass his dstRect. No 'offset' should be necessary. Setting the clipping region to PrInfo.rpage (or even to rpaper) should work fine. Marc Kaufman (kaufman@polya.stanford.edu)
lsr@Apple.COM (Larry Rosenstein) (07/01/88)
In article <1578@microsoft.UUCP> t-benw@forward.UUCP (Benjamin Waldman) writes: > >using DrawPicture to draw the picture in the new rect. The problem is that >nothing is printing out. > >He's drawing to a printer, and is using ClipRect before the DrawPicture >to set the clipping region to the entire page (rPage). Does the picture >have info about its own clipping region that is conflicting with the new >one? The answer to the last question is yes, and that's the problem. When you call OpenPicture and start drawing, Quickdraw records the current clipping region in the picture. A newly-created port has a clipping region that is the largest possible rectangle. The problem is that if you offset a picture when drawing, then this clipping region must be offset too. In this case, however, the coordinates overflow leaving you with an empty clipping region. When creating a picture, one should always set the clipping to the minimum necessary (usually the same as the rectangle passed to OpenPicture). It might be possible to fix the problem by duplicating the picture and changing the clipping: r := pic^^.picFrame; ClipRect(r); newPic := OpenPicture(r); DrawPicture(pic, r); ClosePicture; In theory, newPic should be the same as pic, except with the proper clipping region set. I haven't tried this to see if it works, however. Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 27-AJ Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr