home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!sun-barr!decwrl!csus.edu!netcom.com!afisher
- From: afisher@netcom.com (Alan Fisher)
- Subject: Help with GetPattern/FillRect
- Message-ID: <s64mqzf.afisher@netcom.com>
- Date: Wed, 12 Aug 92 21:51:45 GMT
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 50
-
-
- I am having problems filling a rectangle with a pattern of type 'PAT ' read
- from a resource file. The pattern displayed in the rectangle is completely
- different than the one I defined. When I dump the dereferenced handle returned
- by GetPattern the bit settings are completely different than the pattern
- I defined. Using GetResource('PAT ', 2001) instead of GetPattern does not
- change anything.
-
- What am I doing wrong?
-
- I defined the pattern using ResEdit (pattern id = 2001). In my program I use the
- following code to fill a rectangle:
-
- Handle aHandle;
- aHandle = (Handle) GetPattern(2001);
- FillPattern(aQDRect, aHandle);
-
- FillPattern calls FillRect after loading the resource, locking etc.
- as defined below:
-
- pascal void FillPattern(CRect& theQDRect, Handle aPatHandle)
- {
- Boolean wasLocked;
- if (aPatHandle) {
- if (IsAResource(aPatHandle))
- LoadResource(aPatHandle);
- if (*aPatHandle) {
- PenNormal();
- wasLocked = IsHandleLocked(aPatHandle);
- if (!wasLocked)
- HLock(aPatHandle);
- FillRect(theQDRect, *((PatHandle)aPatHandle));
- if (!wasLocked)
- HUnlock(aPatHandle);
- }
- }
- }
-
-
- Still using MacApp - ETO#7. There are NO other flags I set on the PAT resource
- -- like Purgeable, System Heap etc.
-
- Thanks in advance!!!
- Razi
-
-
- --
- Alan Fisher/Razi Mohiuddin
- Software Partners, Inc. 999 Commercial Street, Palo Alto, CA 94303
- Email: afisher@netcom.com; Phone: (415) 857-1110; Fax: 415-857-1404
-