The required GrayPage routine fills the specified video page with a dithered gray pattern in the current video mode. The page number is 0 based.
OSErr = Control(theDeviceRefNum, cscGrayPage, &theVDPageInfo );
The purpose of the GrayPage routine is to eliminate visual artifacts on the screen during mode changes. When the mode changes, the contents of the frame buffer immediately acquire a new color meaning. To avoid annoying color flashes, two events must occur:
0xAAAAAAAA represents 32 pixels at 1 bpp
0xCCCCCCCC represents 16 pixels at 2 bpp
0xF0F0F0F0 represents 8 pixels at 4 bpp
0xFF00FF00 represents 4 pixels at 8 bpp
0xFFFF0000 represents 2 pixels at 16 bpp
0xFFFFFFF represents 1 pixel at 32 bpp (invert to get the next pixel)
For direct devices, GrayPage also builds a three-channel linear gray color table, gamma-corrects the table, and loads it into the color table hardware.