Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Advanced Color Imaging on the Mac OS /
Chapter 4 - Developing ColorSync-Supportive Applications / Developing Your ColorSync-Supportive Application


Identifying the Current Default System Profile

For the NCMBeginMatching, NCMDrawMatchedPicture, and NCWNewColorWorld functions, your application can specify NULL to signify the default system profile. For all other functions--for example, the CMGetProfileElement function, the CMValidateProfile function, and the CMCopyProfile function--for which you want to specify the default system profile, you must give an explicit reference to the profile. You can use the CMGetSystemProfile function to obtain a reference to the default system profile.

Each profile has a name associated with it, including the profile configured as the default system profile. There are cases in which your application may need to display the name of the default system profile to the user. For example, you may want to present a list or selection menu to your user showing the names of all available display profiles. To obtain the name of the default system profile, your application can call the CMGetScriptProfileDescription function.

To call this function, your application must first obtain a reference to the default system profile because you cannot specify NULL to identify it. Given a profile reference, the CMGetScriptProfileDescription function returns the profile name and script code. Listing 4-3 uses the CMGetSystemProfile and CMGetScriptProfileDescription functions to obtain a reference to the default system profile and the system profile's name and script code.

Listing 4-3 Obtaining the current system profile

void MyPrintSystemProfileName (void)
{
   CMError     cmErr;
   CMProfileRefsysProf;
   Str255      profName;
   ScriptCode  profScript;
   cmErr = CMGetSystemProfile(&sysProf);
   if (cmErr == noErr)
   {
      cmErr = CMGetScriptProfileDescription(sysProf, profName,
                                    &profScript);
      if (cmErr == noErr)
      {
         DrawString(profname);
      }
   }
}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 NOV 1996