Harlequin RIP SDK
cmm_icm2.c File Reference

CMM Implementation of the interface to the Microsoft's Image Color Management. More...

#include <windows.h>
#include <icm.h>
#include "std.h"
#include "cmm_common.h"
#include "cmm_icm2.h"

Data Structures

struct  ICM_TRANSFORM
 Description of a transform specific to the ICM2 example module. More...
 
struct  icm2_implementation
 A subclass of sw_cmm_api used to store class-private information. More...
 

Macros

#define kInternalName   "CMM_ICM2"
 
#define kDisplayName   "Microsoft ICM2"
 

Typedefs

typedef struct ICM_TRANSFORM ICM_TRANSFORM
 Description of a transform specific to the ICM2 example module.
 
typedef struct icm2_implementation icm2_implementation
 A subclass of sw_cmm_api used to store class-private information. More...
 

Functions

static HqBool icm2_init (sw_cmm_api *implementation, const sw_cmm_init_params *params)
 Callback function to ask us to initialise the module. More...
 
static void icm2_finish (sw_cmm_api *implementation)
 Callback function to ask us to tidy up when closing the module. More...
 
static sw_cmm_result icm2_construct (sw_cmm_instance *instance)
 Construct an instance of the sw_cmm_api interface. More...
 
static sw_cmm_result icm2_open_profile (sw_cmm_instance *instance, sw_blob_instance *ICC_profile, sw_cmm_profile *handle)
 Create an internal profile structure for ICC profile data stored in memory. More...
 
static void icm2_close_profile (sw_cmm_instance *instance, sw_cmm_profile profile)
 Close a profile with a handle previously created with icm2_open_profile(). More...
 
static sw_cmm_result icm2_open_transform (sw_cmm_instance *instance, sw_cmm_profile profiles[], uint32 num_profiles, int32 intents[], HqBool black_point_compensations[], uint32 *num_input_channels, uint32 *num_output_channels, sw_cmm_transform *handle)
 Create a transform structure. More...
 
static void icm2_close_transform (sw_cmm_instance *instance, sw_cmm_transform transform)
 Close a transform previously opened with icm2_open_transform(). More...
 
static sw_cmm_result icm2_invoke_transform (sw_cmm_instance *instance, sw_cmm_transform transform, float *input_data, float *output_data, uint32 num_pixels)
 Use the specified transform to adjust color data. More...
 
sw_cmm_apiicm2_getInstance (void)
 Return the singleton instance of a sw_cmm_api object containing details specific to the ICM2 CMM example module. More...
 
static HqBool getColorSpaceFromProfile (HPROFILE hProfile, COLORTYPE *pColorSpace)
 Find the color space used by the specified profile. More...
 
static uint32 getChannelCount (COLORTYPE ctColorSpace)
 Find the number of color channels used in the specified color space. More...
 
static uint32 getChannelCountFromProfile (HPROFILE hProfile)
 Find the number of color channels used in the specified profile. More...
 
static DWORD getICMRenderingIntent (int32 nRIPIntent)
 Convert a rendering intent from the CMM API into its ICM2 equivalent. More...
 
static PCOLOR createTransformBuffer (sw_cmm_instance *instance, uint32 num_pixels)
 Allocate memory to hold COLOR data for the transform process. More...
 
static void convertFloatToCOLORArray (PCOLOR pOutputArray, COLORTYPE ctColorType, float *pInputArray, uint32 num_pixels)
 Convert an array of floating point pixel values to COLOR equivalents. More...
 
static void convertCOLORToFloatArray (float *pOutputArray, COLORTYPE ctColorType, PCOLOR pInputArray, uint32 num_pixels)
 Convert an array of COLOR pixel values to floating point equivalents. More...
 

Variables

static icm2_implementation gImplementation
 Singleton instance describing this alternate CMM.
 

Detailed Description

CMM Implementation of the interface to the Microsoft's Image Color Management.

Macro Definition Documentation

◆ kDisplayName

#define kDisplayName   "Microsoft ICM2"

UTF-8 CMM name for display.

◆ kInternalName

#define kInternalName   "CMM_ICM2"

Short CMM name for configuration.

Typedef Documentation

◆ icm2_implementation

A subclass of sw_cmm_api used to store class-private information.

This example module doesn't currently have class specific data, but it does illustrate how to do the sub-classing.

Function Documentation

◆ convertCOLORToFloatArray()

static void convertCOLORToFloatArray ( float *  pOutputArray,
COLORTYPE  ctColorType,
PCOLOR  pInputArray,
uint32  num_pixels 
)
static

Convert an array of COLOR pixel values to floating point equivalents.

This code is called to reformat pixel data passed between the RIP and ICM2.

Parameters
pOutputArrayPreallocated memory to hold the output data.
ctColorTypeThe type of color value.
pInputArrayArray of COLOR values to convert.
num_pixelsThe number of pixels to convert.
See also
icm2_invoke_transform()

◆ convertFloatToCOLORArray()

static void convertFloatToCOLORArray ( PCOLOR  pOutputArray,
COLORTYPE  ctColorType,
float *  pInputArray,
uint32  num_pixels 
)
static

Convert an array of floating point pixel values to COLOR equivalents.

This code is called to reformat pixel data passed between the RIP and ICM2.

Parameters
pOutputArrayPreallocated memory to hold the output data.
ctColorTypeThe type of color value.
pInputArrayArray of float values to convert.
num_pixelsThe number of pixels to convert.
See also
icm2_invoke_transform()

◆ createTransformBuffer()

static PCOLOR createTransformBuffer ( sw_cmm_instance instance,
uint32  num_pixels 
)
static

Allocate memory to hold COLOR data for the transform process.

Parameters
instanceThe alternate CMM instance.
num_pixelsThe number of pixels to be stored in the buffer.
Returns
A pointer to an allocated memory block, or NULL on error.

◆ getChannelCount()

static uint32 getChannelCount ( COLORTYPE  ctColorSpace)
static

Find the number of color channels used in the specified color space.

For example: RGB => 3 channels, CMYK => 4 channels.

Parameters
ctColorSpaceThe Windows color space
Returns
The number of channels used in the profile, or zero on error.
See also
getChannelCountFromProfile()

◆ getChannelCountFromProfile()

static uint32 getChannelCountFromProfile ( HPROFILE  hProfile)
static

Find the number of color channels used in the specified profile.

For example: RGB => 3 channels, CMYK => 4 channels.

Parameters
hProfileA profile handle.
Returns
The number of channels used in the profile, or zero on error.
See also
getChannelCount()

◆ getColorSpaceFromProfile()

static HqBool getColorSpaceFromProfile ( HPROFILE  hProfile,
COLORTYPE *  pColorSpace 
)
static

Find the color space used by the specified profile.

Parameters
hProfileThe profile to examine.
[in,out]pColorSpacePointer to a COLORTYPE object.
Returns
TRUE on success, FALSE otherwise.

◆ getICMRenderingIntent()

static DWORD getICMRenderingIntent ( int32  nRIPIntent)
static

Convert a rendering intent from the CMM API into its ICM2 equivalent.

As the CMM API supports more rendering intents than ICM2, this is not always a one-to-one mapping.

Parameters
nRIPIntentThe rendering intent as specified through the CMM API.
Returns
An ICM2 rendering intent value.