home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20362 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.4 KB  |  53 lines

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