home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Library Folder / SetRgns.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.2 KB  |  45 lines  |  [TEXT/KAHL]

  1. /* -------------------------------------------------------------------- */
  2. /*                        Blob Rect/Rgn Installation                        */
  3. /* -------------------------------------------------------------------- */
  4.  
  5. # include    "BlobMgr.h"
  6.  
  7.  
  8. /*
  9.  * Set a blob's regions.  This routine makes COPIES of the regions
  10.  * passed in, so the caller should dispose of the regions it passes
  11.  * in itself.  This routine relies on the fact that a blob should
  12.  * never have nil handles for its regions (NewBlob installs empty
  13.  * regions, so those regions are just changed here, not created).
  14.  *
  15.  * The drag region is set equal to the drag region passed in.  The
  16.  * static region is set to the difference of the static and drag
  17.  * regions passed in.
  18.  */
  19.  
  20. pascal void
  21. SetBlobRgns (BlobHandle b, RgnHandle dragRgn, RgnHandle statRgn)
  22. {
  23.     CopyRgn (dragRgn, (**b).dragRgn);
  24.     DiffRgn (statRgn, dragRgn, (**b).statRgn);
  25. }
  26.  
  27.  
  28. /*
  29.  * Set a blob's regions, where the regions are defined by rectangles.
  30.  */
  31.  
  32. pascal void
  33. SetBlobRects (BlobHandle b, Rect *dragRect, Rect *statRect)
  34. {
  35. RgnHandle    dragRgn, statRgn;
  36.  
  37.     dragRgn = NewRgn ();
  38.     statRgn = NewRgn ();
  39.     RectRgn (dragRgn, dragRect);
  40.     RectRgn (statRgn, statRect);
  41.     SetBlobRgns (b, dragRgn, statRgn);
  42.     DisposeRgn (dragRgn);
  43.     DisposeRgn (statRgn);
  44. }
  45.