hGrayTable = (CTabHandle) NewHandle (sizeof (ColorTable) + (255 *
sizeof (ColorSpec)));
(**hGrayTable).ctSeed = GetCTSeed();
(**hGrayTable).ctFlags = 0x00;
(**hGrayTable).ctSize = 255;
for (x = 0; x < 256; x++)
{
(**hGrayTable).ctTable[x].value = x;
(**hGrayTable).ctTable[x].rgb.red = x * 256;
(**hGrayTable).ctTable[x].rgb.green = x * 256;
(**hGrayTable).ctTable[x].rgb.blue = x * 256;
} // end for
(**hGrayTable).ctTable[*pucGray].rgb.red = 0;
(**hGrayTable).ctTable[*pucGray].rgb.green = 0;
(**hGrayTable).ctTable[*pucGray].rgb.blue = 128 * 256;
This seems to work except that when I close my dialog box my system
locks up.
Can anyone see an error in my creation method? Thanks.
Steve
Replace "where-i-work" with s-vision to respond via e-mail.
Also, you need to set the high bit of the flags field to let the value field
be ignored (index is value) and a colour component should be "smeared"
across 16 bits i.e. an 8-bit value 5F becomes 5F5F in an RGB record- i..e
(short) c << 16 | c, rather than c * 256.
If you are getting a crash, it is probably because you wrote beyond the end
of the handle and hit something in your heap.
GC.
Steve wrote in message <3679ABEB...@where-i-work.com>...