1. |
Define the following global variables: |
Dim ClrHandle As LongDim cnvParam As CONVERSION_PARAMSDim wtPoint As WHITEPOINT 'this needs to be defined in VB, because its member in CONVERSION_PARAMS can't be accessed since it is a pointer and not a structureDim RGBColor(3) As ByteDim ColorSpace(4) As Byte
2. |
Set the conversion options by filling a CONVERSION_PARAMS structure: |
wtPoint.nWhitePoint = CIELAB_D50wtPoint.xWhite = 0wtPoint.yWhite = 0cnvParam.uStructSize = Len(cnvParam)cnvParam.nQuantization = 8cnvParam.nMethod = USE_CUSTOM_ICCcnvParam.nActiveMethod = USE_CUSTOM_ICCcnvParam.pCmykParams = 0cnvParam.pLabParams = 0cnvParam.pYuvParams = 0cnvParam.sDstInputTable(0) = 0cnvParam.pWpoint = VarPtr(wtPoint)cnvParam.pMemInputProfile = 0cnvParam.pMemOutputProfile = 0Dim str1 As Stringstr1 = "C:\\MyRGBProfile.ICM"Dim i As IntegerFor i = 0 To Len(str1) - 1cnvParam.sInputProfile(i) = Asc(Right(str1, Len(str1) - i))Next istr1 = "C:\\MyRGBProfile.ICM"For i = 0 To Len(str1) - 1cnvParam.sOutputProfile(i) = Asc(Right(str1, Len(str1) - i))Next i
3. |
Initialize the color conversion handle with L_ClrInit (): |
L_ClrInit ClrHandle, CCS_CMYK, CCS_RGB, cnvParam 4. |
Now, do the conversion: |
ColorSpace(0) = 100ColorSpace(1) = 100ColorSpace(2) = 100ColorSpace(3) = 100L_ClrConvert ClrHandle, ColorSpace(0), RGBColor(0), 1, 1, 0, 0
5. |
At the end, free the color conversion handle: |
L_ClrFree ClrHandle