home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13901 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.7 KB  |  60 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!sun-barr!decwrl!csus.edu!netcom.com!afisher
  3. From: afisher@netcom.com (Alan Fisher)
  4. Subject: Help with GetPattern/FillRect
  5. Message-ID: <s64mqzf.afisher@netcom.com>
  6. Date: Wed, 12 Aug 92 21:51:45 GMT
  7. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  8. Lines: 50
  9.  
  10.  
  11. I am having problems filling a rectangle with a pattern of type 'PAT ' read
  12. from a resource file.  The pattern displayed in the rectangle is completely
  13. different than the one I defined.  When I dump the dereferenced handle returned
  14. by GetPattern the bit settings are completely different than the pattern
  15. I defined.  Using GetResource('PAT ', 2001) instead of GetPattern does not
  16. change anything.
  17.  
  18. What am I doing wrong?
  19.  
  20. I defined the pattern using ResEdit (pattern id = 2001).   In my program I use the 
  21. following code to fill a rectangle:
  22.  
  23.     Handle aHandle;
  24.     aHandle = (Handle) GetPattern(2001);
  25.     FillPattern(aQDRect, aHandle);
  26.     
  27. FillPattern calls FillRect after loading the resource, locking etc.
  28. as defined below:
  29.  
  30. pascal void FillPattern(CRect& theQDRect, Handle aPatHandle)
  31. {
  32.     Boolean wasLocked;
  33.     if (aPatHandle) {
  34.         if (IsAResource(aPatHandle))
  35.             LoadResource(aPatHandle);
  36.         if (*aPatHandle) {
  37.             PenNormal();
  38.             wasLocked = IsHandleLocked(aPatHandle);
  39.             if (!wasLocked)
  40.                 HLock(aPatHandle);    
  41.             FillRect(theQDRect, *((PatHandle)aPatHandle));
  42.             if (!wasLocked)
  43.                 HUnlock(aPatHandle);
  44.         }
  45.     }
  46. }
  47.  
  48.  
  49. Still using MacApp - ETO#7.   There are NO other flags I set on the PAT resource
  50. -- like Purgeable, System Heap etc. 
  51.  
  52. Thanks in advance!!!
  53. Razi
  54.  
  55.  
  56. -- 
  57. Alan Fisher/Razi Mohiuddin
  58. Software Partners, Inc.  999 Commercial Street, Palo Alto, CA 94303
  59. Email: afisher@netcom.com;     Phone: (415) 857-1110;      Fax: 415-857-1404
  60.