home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!geek
- From: geek@casbah.acns.nwu.edu (Myrland Gray)
- Subject: Re: What am I doin wrong?
- Message-ID: <1992Dec28.224411.22427@news.acns.nwu.edu>
- Keywords: pixmap
- Sender: geek@casbah.acns.nwu.edu
- Nntp-Posting-Host: unseen1.acns.nwu.edu
- Organization: Northwestern University, Evanston Illinois.
- References: <1992Dec27.133008.1@vax1.mankato.msus.edu>
- Distribution: usa
- Date: Mon, 28 Dec 1992 22:44:11 GMT
- Lines: 38
-
- In article <1992Dec27.133008.1@vax1.mankato.msus.edu> t303grey@vax1.mankato.msus.edu writes:
- > Please read the code following and tell me why it not working. I'm totaly
- >lost in these cases and have no other way to find an enlightment other than
- >asking the infinite wisdom of the net.
- >
- >*** problem 1: (Error checking code are deleted, assume best case)
- > GetGWorld( &oldPort, &oldDevice );
- > Err = NewGWorld( &offWorld, 8, &theScreen, NULL, NULL, 0 );
- > SetGWorld( offWorld, NULL );
- > pixBase = GetGWorldPixMap( offWorld );
- > LockPixels( pixBase );
- > EraseRect( &theScreen );
- > SetGWorld( oldPort, oldDevice );
- > CopyBits( &pixBase,
- > &(*(GrafPtr) pCWindow).portBits,
- > &theScreen, &theScreen, srcCopy, NULL );
- > UnlockPixels( pixBase );
- >
- > Strange thing about this code is if I substitute the 1st argument of CopyBits
- >call to &(*(GrafPtr) offWorld).portBits it works fine. But according to IM7 we
- >should never dereference GWorld (p21-5 paragraph 3) to get to pixMap. Right?
-
- It looks to me like the problem is that you are passing the address of the
- handle to your pixmap, rather than a pointer to a pixmap. In other words, with
- your first parameter to CopyBits, three dereferences are necessary in order to
- access the contents of the pixmap. However, CopyBits will only do a single
- dereference of its first (and second) parameters to get to the "guts" and so
- who really knows what you were blasting into your window (if anything). The fix
- is to lock your pixel map, pass *pixBase (maybe type-casted as a BitMap* ???),
- and then unlock your pixel map. That should work. I've done exactly what you
- seem to have done so many times, I could solve this in my sleep!
-
- As some of the other responses to your query have pointed out, the routines you
- are using are specific to system 7. Just make sure that's really what you want.
-
- Joey Gray
- geek@casbah.acns.nwu.edu
-
-