home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20338 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  2.1 KB

  1. Path: sparky!uunet!pageworks.com!world!eff!news.byu.edu!gatech!swrinde!cs.utexas.edu!usc!wupost!spool.mu.edu!umn.edu!msus1.msus.edu!vax1.mankato.msus.edu!t303grey
  2. Newsgroups: comp.sys.mac.programmer
  3. Subject: What am I doin wrong?
  4. Message-ID: <1992Dec27.133008.1@vax1.mankato.msus.edu>
  5. From: t303grey@vax1.mankato.msus.edu
  6. Date: 27 Dec 92 13:30:08 -0600
  7. Organization: Mankato State University
  8. Nntp-Posting-Host: vax1.mankato.msus.edu
  9. Lines: 44
  10.  
  11.   Please read the code following and tell me why it not working. I'm totaly
  12. lost in these cases and have no other way to find an enlightment other than
  13. asking the infinite wisdom of the net.
  14.  
  15. *** problem 1: (Error checking code are deleted, assume best case)
  16.  
  17.     GetGWorld( &oldPort, &oldDevice );
  18.     Err = NewGWorld( &offWorld, 8, &theScreen, NULL, NULL, 0 );
  19.     SetGWorld( offWorld, NULL );
  20.         
  21.     pixBase = GetGWorldPixMap( offWorld );
  22.     LockPixels( pixBase );
  23.     
  24.     EraseRect( &theScreen );
  25.  
  26.     SetGWorld( oldPort, oldDevice );
  27.          
  28.     CopyBits( &pixBase,
  29.                 &(*(GrafPtr) pCWindow).portBits,
  30.                 &theScreen, &theScreen, srcCopy, NULL );
  31.         
  32.     UnlockPixels( pixBase );
  33.  
  34.   Strange thing about this code is if I substitute the 1st argument of CopyBits
  35. call to &(*(GrafPtr) offWorld).portBits it works fine. But according to IM7 we
  36. should never dereference GWorld (p21-5 paragraph 3) to get to pixMap. Right?
  37.  
  38. *** problem 2: (Again no error checks here. Assume best case)
  39.  
  40.     pCWindow = GetNewCWindow( 128, NULL, (Ptr) -1 );
  41.     GridColorPalette = NewPalette( 256, GetCTable( ctID ), 
  42.                         pmTolerant + pmExplicit, 0 );
  43.     SetPalette( pCWindow, GridColorPalette, false );
  44.     ActivatePalette( pCWindow );
  45.  
  46.   When I quit the app contains this code, color palette are never restored to
  47. original even after I dispose pCWindow. If I leave out pmExplicit from
  48. NewPalette call it works fine but it defeat the purpos of cTable. IM7 says
  49. (p20-7 paragraph 6) that when the window is closed Palette Manager should
  50. restore the palette (unless app calls ProtectEntries but I never call it).
  51.  
  52. Thanks in advance
  53. DevilCat
  54.  
  55.