> char ctbl_buf[sizeof (ColorTableType) + 2 * sizeof (RGBColorType)];
> ColorTableType *ctbl = (ColorTableType *) ctbl_buf;
> RGBColorType *colors = ColorTableEntries (ctbl);
> BitmapType *bm;
> UInt16 err;
> 
> ctbl->numEntries = 2;
> colors[0].r = colors[0].g = colors[0].b = 0;
> colors[1].r = colors[1].g = colors[1].b = 0xff;
> 
> bm = BmpCreate (10, 10, 1, ctbl, &err);

This is exactly what I ended up doing. I'm not sure if I should make the
ctbl_buf larger (and still use ColorTableEntries) in case they add a spacer
after the numEntries. Irrespective, how you're supposed to set numEntries
without knowing the structure contents is a mystery to me!

> This works fine for me, and doesn't upset the emulator.  Perhaps you
> could show us the code that triggers a warning from the emulator.

I managed to fix this ... I had a MemPtrFree instead of BmpDelete left over
from the bad ol' days when I was constructing the new bitmap manually. My
mistake.

I really wish there was simply a BmpSetColorTable function. Having to create
a new bitmap, set it in a window, draw from the old one to copy the bits,
then finally draw to the screen is a fair bit of mucking around. (WinPalette
doesn't work either as it's always drawn as grayscale, presumably because
the original bitmap doesn't have a colortable.)

Thanks for your help!

Stephen Best
Bitware Australia


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to