home *** CD-ROM | disk | FTP | other *** search
- /* -------------------------------------------------------------------- */
- /* Blob Picture Creation Routines */
- /* -------------------------------------------------------------------- */
-
- # include "BlobMgr.h"
-
-
- /*
- * Internal picture drawing scratch variables
- */
-
- static PicHandle picHand;
- static Rect picRect = { -30000, -30000, 30000, 30000 };
-
-
- pascal void
- OpenBlob (void)
- {
- picHand = OpenPicture (&picRect);
- }
-
-
- /*
- * Close a picture blob. The picture that was begin with OpenBlob is
- * installed in the blob record and the blob type is set to picture
- * (as opposed to proc) blob. The picture is replayed with a frame
- * that is the union of the bounding boxes of the static and drag regions.
- * This will usually be sufficiently reasonable to avoid the problem
- * of overflow that sometimes results from scaling the clipping region
- * when a picture is drawn in a different size than the original.
- * The dragRect and statRect fields are set to those rects bounding
- * the parts of the picture corresponding to the two regions. These
- * are used to cope in the event that the blob is moved or resized.
- * (See DrawBlob() and DrawBlobPic().)
- *
- * ClosePicBlob() does NOT set the blob's regions. That must be done
- * by the caller after calling ClosePicBlob().
- */
-
- static void
- ClosePicBlob (BlobHandle b, Rect *dragRect, Rect *statRect)
- {
- Rect pRect;
- PicHandle p;
- RgnHandle oldClip;
-
- ClosePicture (); /* stop saving picture definition */
- DisposeBlobPic (b); /* toss any pic the blob might have had */
- UnionRect (dragRect, statRect, &pRect);
- oldClip = NewRgn ();
- GetClip (oldClip);
- ClipRect (&pRect); /* avoid clipping problem on picture */
- p = OpenPicture (&pRect); /* replay later on - this prevents */
- DrawPicture (picHand, &picRect); /* overflow if pic is scaled up */
- ClosePicture ();
- KillPicture (picHand); /* don't need original picture now */
- SetClip (oldClip);
- DisposeRgn (oldClip);
- (**b).bPicProc.bPic = p;
-
- (**b).dragRect = *dragRect; /* install original drag Rect */
- (**b).statRect = *statRect; /* install original static Rect */
-
- SetBlobFlags (b, bPicMask); /* set type as picture blob */
- }
-
-
- /*
- * Close a picture blob whose regions are defined by rectangles.
- */
-
- pascal void
- CloseRectBlob (BlobHandle b, Rect *dragRect, Rect *statRect)
- {
- ClosePicBlob (b, dragRect, statRect);
- SetBlobRects (b, dragRect, statRect);
- if (BlobEnabled (b))
- DrawBlob (b, inFullBlob);
- }
-
-
- /*
- * Close a picture blob.
- */
-
- pascal void
- CloseRgnBlob (BlobHandle b, RgnHandle dragRgn, RgnHandle statRgn)
- {
- Rect dragRect, statRect;
-
- dragRect = (**dragRgn).rgnBBox;
- statRect = (**statRgn).rgnBBox;
- ClosePicBlob (b, &dragRect, &statRect);
- SetBlobRgns (b, dragRgn, statRgn);
- if (BlobEnabled (b))
- DrawBlob (b, inFullBlob);
- }
-