We have the following code to get the number of bits per pixel for the current display on OS X systems:
#if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL)
*dp = CGDisplayBitsPerPixel (display);
#else
/* FIXME: This will only work for MacOS > 10.5. For earlier versions this code is not needed (use CGDisplayBitsPerPixel instead). */
CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display); CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode);
if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0) *dp = 32; else if (CFStringCompare (pixelEncoding, CFSTR (IO16BitDirectPixels), 0) == 0) *dp = 16; else *dp = 8;
#endif
But now I see that the function CGDisplayModeCopyPixelEncoding has been deprecated for OS X 10.11. Is there a replacement? It doesn't have to be a direct replacement for this function, we just need some way to get a value for the number of bits per pixel for the display.
jwe
Unfortunately, I don’t think there are any good options. As far as I can tell, Apple is trying to move toward “act like you have 30 bit depth and we will take care of making it look right if it is something less”.
Sorry to not be more help.
John S.
|