Is there any method to load DIB with CMYK image format. I am using the following method to store image pixel to DIB. In this case raster image in the RGBA format is used. We cannot store CMYK pixel. Is there any method for actual CMYK pixel images than this given below???
BITMAPINFOHEADER bi =(BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER )+256*sizeof(RGBQUAD));
// Get the size of the DIB
dwDIBSize = imageWidth*imageLength;/*GetDIBSize(& bi );*/
// Allocate for the BITMAPINFO structure and the color table.
/*pDIB = GlobalAllocPtr( GHND, dwDIBSize );*/
HDC dc = CreateCompatibleDC(pDC->GetSafeHdc());
hBmp = CreateDIBSection(dc, (BITMAPINFO*)bi, DIB_RGB_COLORS,
*((BITMAPINFOHEADER*)pDIB) = *bi ;
// Get a pointer to the color table
RGBQUAD *pRgbq = (RGBQUAD *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
int sizeWords = bi->biSizeImage/4;
RGBQUAD* rgbDib = (RGBQUAD*)pDIB;
LPRGBQUAD lpr = (LPRGBQUAD)pDIB;
long* rgbTif = (long*)raster;
// Swap the byte order while copying
for ( int i = 0 ; i < sizeWords ; ++i )
{
rgbDib[i].rgbRed = TIFFGetR(rgbTif[i]);
rgbDib[i].rgbBlue = TIFFGetB(rgbTif[i]);
rgbDib[i].rgbGreen = TIFFGetG(rgbTif[i]);
rgbDib[i].rgbReserved = 0;
}