home *** CD-ROM | disk | FTP | other *** search
- 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
- Newsgroups: comp.sys.mac.programmer
- Subject: What am I doin wrong?
- Message-ID: <1992Dec27.133008.1@vax1.mankato.msus.edu>
- From: t303grey@vax1.mankato.msus.edu
- Date: 27 Dec 92 13:30:08 -0600
- Organization: Mankato State University
- Nntp-Posting-Host: vax1.mankato.msus.edu
- Lines: 44
-
- 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?
-
- *** problem 2: (Again no error checks here. Assume best case)
-
- pCWindow = GetNewCWindow( 128, NULL, (Ptr) -1 );
- GridColorPalette = NewPalette( 256, GetCTable( ctID ),
- pmTolerant + pmExplicit, 0 );
- SetPalette( pCWindow, GridColorPalette, false );
- ActivatePalette( pCWindow );
-
- When I quit the app contains this code, color palette are never restored to
- original even after I dispose pCWindow. If I leave out pmExplicit from
- NewPalette call it works fine but it defeat the purpos of cTable. IM7 says
- (p20-7 paragraph 6) that when the window is closed Palette Manager should
- restore the palette (unless app calls ProtectEntries but I never call it).
-
- Thanks in advance
- DevilCat
-
-