CMYKRaster Example for C++ 5.0 and later
/* This example will load an array of CMYK TIFF files and increase the brightness of the K plane only */
/* (which will darken the image) and save the file as CMYK TIFF */
ILEADRaster * pRaster;
ILEADRasterProcess * pRasterProc;
ILEADRasterView * pRasterView;
void TestLoadCMYKArray(ILEADRasterIO * pRasterIO)
{
short nRet;
nRet = pRasterIO->GetFileInfo(pRaster, TEXT("cmyk.tif"), 0, 0);
if (nRet != 0)
{
MessageBox(NULL, "Invalid source file", "Error", MB_OK);
return;
}
pRasterIO->CMYKRasterCount = 4;
nRet = pRasterIO->LoadFileCMYKArray(TEXT("cmyk.tif"), 8, 1);
if (nRet != 0)
{
MessageBox(NULL, "LoadFileCMYKArray failed!", "Error", MB_OK);
return;
}
/* The load has succeeded.
Increase the brightness of the K (black) plane by 50%
Note that this will DARKEN the image, because we increased the amount of black! */
nRet = pRasterProc->Intensity(pRasterIO->CMYKRaster[3], 500);
if (nRet != 0)
MessageBox(NULL, "Intensity failed!", "Error", MB_OK);
else
{
nRet = pRasterIO->SaveFileCMYKArray(TEXT("c:\\myCMYK.tif"), FILE_TIFLZW_CMYK, 8, 2, 0,False);
if (nRet != 0)
MessageBox(NULL, "SaveFileCMYKArray failed!", "Error", MB_OK);
}
pRasterView->RasterIO = pRasterIO;
pRasterView->EnablePaintCMYKArray = TRUE;
}