octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OS X help needed


From: John W. Eaton
Subject: OS X help needed
Date: Thu, 27 Oct 2016 13:05:45 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]