[comp.sys.mac.programmer] Palettes

t-stephp@microsoft.UUCP (Stephen Poole) (05/15/89)

Well, I got no response last time so I'll try again...

I'm attempting to use the Palette Manager.  I have constructed my palette
like this:

	PalHandle = NewPalette( 256, NULL, pmExplicit, 0x0000 );
	for( i = 0; i < 256; i++ )
	{
            /* Read some RGB data and put it into RGBColor rgb */
	    SetEntryColor( PalHandle, i, &rgb );
	}

I am certain that I'm putting the palette together correctly, but I
don't really care about the contents at this point.

The next step is to associate that palette with a window.  I'm trying
to do that like this:

	SetPalette( Win, PalHandle, TRUE );
	ActivatePalette( Win );

Since I am using all 256 entries in the palette I would expect to see
an immediate change in the color environment.  I don't.  I write to an
offscreen pixMap and then CopyBits that pixMap to this window, and the
colors being used are obviously coming straight out of the system palette.

I have also tried using (WindowPtr)(-1) in place of my window pointer
for SetPalette and ActivatePalette, thinking that this might alter the
system palette, but still don't see any change.  It's obvious that I'm
missing something here, but what?  Someone out there must have used
the Palette Manager before!

Thanks for any assistance.

-- 
-- Stephen D. Poole -- t-stephp@microsoft.UUCP -- Mac II Fanatic --
--                                                               --
-- I'm just an Oregon Tech Software Engineering co-op at  Micro- --
-- soft.  Believe me, nobody here pays attention to my opinions! --