The Quickdraw color table for the offscreen should ramp from white at location 0 to black at location 255. Quickdraw always assumes that white and black will be in these locations, and does not perform correctly when this isn't the case. However, this is the opposite of the intensity value in a grey-scaled image, where black would be at 0, and white at 255.
The other thing that is required is a routine to convert from the custom data structure to the QuickDraw offscreen. This conversion can be accomplished by taking the top 8 bits of each grey pixel, inverting them and copying it into the offscreen GWorld. A good source of info would be "Drawing in GWorlds for Speed and Versatility" in Develop issue 10. The following snippet of code accumulates four pixels worth of data, converting from a 16-bit grey pixel to an 8-bit color index.
UInt16 *sourceGreyPtr; UInt32 *destPixelsPtr; UInt16 pixel1, pixel2, pixel3, pixel4; UInt32 pixelOutput; { pixel1 = sourceGreyPtr[0]; pixel2 = sourceGreyPtr[1]; pixel3 = sourceGreyPtr[2]; pixel4 = sourceGreyPtr[3]; // Shift each pixel to its location, take the complement, and mask out the correct byte pixel1 = ~(pixel1 << 16) & 0xFF000000; pixel2 = ~(pixel2 << 8) & 0x00FF0000; pixel3 = ~(pixel3) & 0x0000FF00; pixel4 = ~(pixel4 >> 8) & 0x000000FF; pixelOutput = (pixel1 << 24) | (pixel2 << 16) | (pixel3 << 8) | (pixel4); *destPixelsPtr = pixelOutput; sourceGreyPtr +=4; // Advances 8 bytes destPixelsPtr +=1; // Advances 4 bytes }Quickdraw GX does include a luminance-based color model (
gxGraySpace
).