Conversion Given an ICM Profile (Delphi 4.0)

1.

Define the following global variables:

   ClrHandle : THandle;
   params : CONVERSION_PARAMS;
   RGBColor : array[0..2] of UCHAR;
   ColorSpace : array[0..3] of UCHAR;

2.

Set the conversion options by filling a CONVERSION_PARAMS structure:

   ZeroMemory(Pointer(@params), SizeOf(CONVERSION_PARAMS));

   params.uStructSize := SizeOf(CONVERSION_PARAMS);
   params.nMethod := USE_CUSTOM_ICC;
   params.nActiveMethod := USE_CUSTOM_ICC;
   New(params.pWpoint);
   params.pWpoint.nWhitePoint := CIELAB_D50;

   StrCopy (params.sInputProfile, ‘C:\MyCMYKProfile.ICM’);
   StrCopy (params.sOutputProfile, ‘C:\MyRGBProfile.ICM’);

   params.pMemInputProfile := nil;
   params.pMemOutputProfile := nil;

3.

Initialize the color conversion handle with L_ClrInit():

L_ClrInit(@ClrHandle, CCS_CMYK, CCS_RGB, @params);

4.

Now, do the conversion:

   ColorSpace[0] := 100;
   ColorSpace[1] := 100;
   ColorSpace[2] := 100;
   ColorSpace[3] := 100;

   L_ClrConvert(ClrHandle, Pointer(ColorSpace), Pointer(RGBColor), 1, 1, 0, 0);

5.

At the end, free the color conversion handle:

   L_ClrFree(ClrHandle);

See Also:

Introduction

Programming with Color Conversion

Color Conversion C DLL Function Groups

Visual C++ Tutorials

Delphi Tutorials

Visual Basic Tutorials