![]() |
PATH![]() |
![]() ![]() |
Starting with ColorSync version 2.5, a user can select a separate profile for each display, as described in
Setting a Profile for Each Monitor
. In your code, you can determine the profile for any display for which you know the AVID by calling the function
CMGetProfileByAVID
, which is also new in version 2.5. You can get more information about AVID values from the Display Manager SDK.
Listing 3-5 shows how to get the profile for the main display (the one that contains the menu bar).
Listing 3-5 Getting the profile for the main display
CMError GetProfileForMainDisplay (CMProfileRef *prof)
{
CMError theErr;
AVIDType theAVID;
GDHandle theDevice;
// Get the main GDevice.
theDevice = GetMainDevice();
// Get the AVID for that device.
theErr = DMGetDisplayIDByGDevice(theDevice, &theAVID, true);
require(theErr == noErr, cleanup);
// Get the profile for that AVID.
theErr = GetProfileByAVID(theAVID, prof);
require(theErr == noErr, cleanup);
// Do any necessary cleanup. In this case, just return.
cleanup:
return theErr;
}
This code first gets a graphic device handle for the main display, then calls the Display Manager routine
DMGetDisplayIDByGDevice
to get an AVID for the device. It then passes the AVID to the ColorSync Manager routine
CMGetProfileByAVID
to get a profile reference to the profile for the display.