Initializes the ICC header with its default values.
#include "ltwrappr.h"
L_INT LICCProfile::InitHeader();
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The header information is contained within the IccHeader member of the class object's ICCPROFILEEXT member structure. The class object should be initialized by calling LICCProfile::Initialize, before calling this function. This function initializes the IccHeader member of the class object's ICCPROFILEEXT member structure with its default values. It must be called before filling any of the header fields. Once the header fields have been initialized, they can be set using the following functions:
If this function is called after any of the functions listed above, the header fields will be re-initialized to their default values, and the individually set values will be lost.
LICCProfile::Initialize should be called before calling LICCProfile::InitHeader. If LICCProfile::Initialize is called after LICCProfile::InitHeader, the default values set by LICCProfile::InitHeader will be lost.
This example, initializes an ICC Profile, goes through all the steps of initializing and filling the fields of the header, creates some tags, generates an ICC profile pointer, saves it into an ICC file, and then frees the ICC Profile
L_INT LICCProfile_InitHeaderExample()
{
L_INT nRet = FAILURE;
LICCProfile IccProfile;
// Initialize the ICC Profile
nRet = IccProfile.Initialize ();
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Initialize the header
nRet = IccProfile.InitHeader();
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the CMM type to zero
nRet = IccProfile.SetCMMType (0);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the Device Class to Input Class
nRet = IccProfile.SetDeviceClass (InputClass);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the Color Space to RGB
nRet = IccProfile.SetColorSpace (RgbData);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the PCS to XYZ
nRet = IccProfile.SetConnectionSpace (XyzData);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the primary platform to zero
nRet = IccProfile.SetPrimaryPlatform (NoPlatformSignature);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the profile flags into not embedded, and independent
nRet = IccProfile.SetFlags (ICC_EMBEDDED_PROFILE_FALSE|ICC_USE_ANYWHERE);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the device manufacturer signature to zero
nRet = IccProfile.SetDevManufacturer (0);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the device model to 0
nRet = IccProfile.SetDevModel (0);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the device attributes to be reflective, glossy, positive and colored media
nRet = IccProfile.SetDeviceAttributes (ICC_REFLECTIVE|ICC_GLOSSY|ICC_MEDIA_POLARITY_POSITIVE|ICC_COLOR_MEDIA);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the profile rendering intent
nRet = IccProfile.SetRenderingIntent (Perceptual);
if (nRet != SUCCESS)
{
IccProfile.Free ();
return nRet;
}
// Set the profile creator to 0
nRet = IccProfile.SetCreator (0);
// Free the ICC Profile
IccProfile.Free ();
return nRet;
}