L_ColorSeparateBitmap

#include "l_bitmap.h"

L_LTIMGCLR_API L_INT L_ColorSeparateBitmap(pBitmap, ppBitmap, uStructSize, uFlags)

pBITMAPHANDLE pBitmap;

pointer to the source bitmap handle

pBITMAPHANDLE *ppBitmap;

pointers to the grayscale bitmaps

L_UINT uStructSize;

size in bytes, of the structures pointed to by ppBitmap

L_UINT uFlags;

type of separation

Separates the specified bitmap by color plane to produce one grayscale image per plane. You can specify any of several color-space models, including CMYK.

Parameter Description
pBitmap Pointer to the bitmap handle referencing the bitmap to separate.
ppBitmap An array of pointers to the bitmap handles that will reference the grayscale bitmaps when they are created.
uStructSize Size in bytes, of the structures pointed to by ppBitmap, for versioning. Use sizeof(BITMAPHANDLE).
  The pointers in the array should be in the appropriate order, which in most cases is the order of the letters in the name. For example, for CMY separation, the first pointer should be for the cyan plane, the second for magenta, and the third for yellow. The only exception is RGB, which should be in BGR (blue, green, red) order.
uFlags The type of separation.  Possible values are:
  Value Meaning
  COLORSEP_RGB [0x0000] Create images for three RGB planes.
  COLORSEP_CMYK [0x0001] Create images for four CMYK planes.
  COLORSEP_HSV [0x0002] Create images for three HSV planes.
  COLORSEP_HLS [0x0003] Create images for three HLS planes.
  COLORSEP_CMY [0x0004] Create images for three CMY planes.
  COLORSEP_YUV [0x0005] Create images for three YUV planes.
  COLORSEP_XYZ [0x0006] Create images for three XYZ planes.
  COLORSEP_LAB [0x0007] Create images for three LAB planes.
  COLORSEP_YCrCb [0x0008] Create images for three YCrCb planes.
  COLORSEP_SCT [0x0009] Create images for three SCT planes.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

The supported color-space models are RGB, CMYK, CMY, HSV, HLS, YUV, XYZ, LAB, YCrCb and SCT.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available in the Document and Medical Imaging toolkits.

If the pBitmap is a 48 or 64-bit bitmap, then the created bitmaps are 16 bit grayscale. Otherwise the created bitmaps are 8 bit grayscale.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGCLR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_ColorMergeBitmap, L_ConvertColorSpace,

 

L_DlgColorRes, L_WindowLevel, L_ChannelMix, L_DeinterlaceBitmap, L_DesaturateBitmap, L_EdgeDetectStatisticalBitmap, L_LightControlBitmap, L_SmoothEdgesBitmap, L_AutoColorLevelBitmap, L_ColorLevelBitmap, L_CorrelationBitmap, L_GrayScaleToDuotone, L_GrayScaleToMultitone, L_HolesRemovalBitmapRgn, L_SelectiveColorBitmap, L_SkeletonBitmap

Topics:

Processing an Image

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

 

Color Halftone and Halftone Images

 

Raster Image Functions: Processing an Image

Example

For complete sample code, refer to the CHILD.C module of the DEMO example. This example creates color separations and merges them.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT ColorSeparateBitmapExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap;                  /* Bitmap handle to hold the loaded image */ 
   BITMAPHANDLE ColorPlanes[4];              /* Array of bitmap handles */ 
   pBITMAPHANDLE pColorPlanes[4];          /* Array of pointers to bitmap handles */ 
   /* Assign bitmap handle addresses to the pointers */ 
   pColorPlanes[0] = &ColorPlanes[0]; 
   pColorPlanes[1] = &ColorPlanes[1]; 
   pColorPlanes[2] = &ColorPlanes[2]; 
   pColorPlanes[3] = &ColorPlanes[3]; 
   /* Load the bitmap, at its own bits per pixel */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("sample5.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Separate the color planes */ 
   nRet = L_ColorSeparateBitmap(&LeadBitmap, pColorPlanes, sizeof(BITMAPHANDLE), COLORSEP_CMYK); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Free the bitmap */ 
   if(LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
   /* Merge the color planes */ 
   nRet = L_ColorMergeBitmap(&LeadBitmap, pColorPlanes, sizeof(BITMAPHANDLE), COLORSEP_CMYK); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Free the bitmaps used for color planes */ 
   if(pColorPlanes[0]->Flags.Allocated) 
      L_FreeBitmap(pColorPlanes[0]); 
   if(pColorPlanes[1]->Flags.Allocated) 
      L_FreeBitmap(pColorPlanes[1]); 
   if(pColorPlanes[2]->Flags.Allocated) 
      L_FreeBitmap(pColorPlanes[2]); 
   if(pColorPlanes[3]->Flags.Allocated) 
      L_FreeBitmap(pColorPlanes[3]); 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //free bitmap 
   if(LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help