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 Reference /
Chapter 4 - ColorSync Manager Reference for Color Management Modules / Required CMM-Defined Functions
/


MyNCMInit

Handles the kNCMMInit request by performing any required private initialization.

A CMM must respond to the kNCMMInit request code. The ColorSync Manager sends this code to request your CMM to instantiate any private data it needs. A CMM responds to the kNCMMInit request code by calling a CMM-defined subroutine, for example, MyNCMInit to handle the request.

The MyNCMInit function is a color management module-defined subroutine.

pascal CMError MyNCMInit (
ComponentInstance CMSession,
CMProfileRef srcProfile,
CMProfileRef dstProfile);
CMSession
A handle to your CMM's storage for the instance of your component associated with the calling application or device driver.
srcProfile
A reference to the source profile to use in the color-matching or color-checking session. Your CMM should store any profile information it requires before returning to the Component Manager. (The calling program obtained the profile reference passed in this parameter.)
dstProfile
A reference to the destination profile to use in the color-matching or color-checking session. Your CMM should store any profile information it requires before returning to the Component Manager. (The calling program obtained the profile reference passed in this parameter.)
function result
A result code of type CMError. See "Result Codes" (page 3-172) for a list of ColorSync-specific result codes.
DISCUSSION
The Component Manager calls your CMM with the kNCMMInit request code when a ColorSync-supportive application or device driver specifies your CMM for a color-matching or color-checking session. For example, when an application or device driver calls the NCWNewColorWorld function, the Component Manager calls your MyNCMInit function.

Using the storage pointed to by the CMSession handle, your MyNCMInit function should initialize any private data your CMM will need for the color session and for handling subsequent calls pertaining to this component instance. Your function must obtain required information from the profiles and initialize private data for subsequent color-matching or color-checking sessions with these values. After your function returns to the Component Manager, it no longer has access to the profiles.

This request gives you the opportunity to examine the profile contents before storing them. If you do not support some aspect of the profile, then you should return an unimplemented error in response to this request. For example, if your CMM does not implement multichannel color support, you should return an unimplemented error at this point.

In addition to the standard profile information you should preserve in response to this request, you should preserve the quality flag setting specified in the profile header and the rendering intent, also specified in the header.

The Component Manager calls your CMM with a standard open request to open the CMM when a ColorSync-supportive application or device driver requests that the Component Manager open a connection to your component. At this time, your component should allocate any memory it needs to maintain a connection for the requesting application or driver. You should allocate memory from the current heap zone. If that attempt fails, you should allocate memory from the system heap or the temporary heap. You can use the SetComponentInstanceStorage function to associate the allocated memory with the component instance. Whenever the calling application or driver requests services from your component, the Component Manager supplies you with the handle to this memory in the CMSession parameter.

The Component Manager may call your CMM with the kNCMMInit request code multiple times after it calls your CMM with a request to open the CMM. For example, it may call your CMM with an initialization request once with one pair of profiles and then again with another pair of profiles. For each call, you need to reinitialize the storage based on the content of the current profiles.

Your CMM should support all seven classes of profiles defined by the ICC. For information on the seven classes of profiles, see "ColorSync Manager Reference for Applications and Device Drivers" in Advanced Color Imaging Reference.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996