L_SetBitmapRgnColorRGBRange

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_SetBitmapRgnColorRGBRange(pBitmap, crLower, crUpper, uCombineMode)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

COLORREF crLower;

/* minimum RGB color value */

COLORREF crUpper;

/* maximum RGB color value */

L_UINT uCombineMode;

/* action to take regarding the existing region */

Creates or updates the bitmap region by adding a region that consists of all the pixels that fall in the range crLower ... crUpper, inclusively.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap where the region is to be created or updated.

crLower

COLORREF that contains the minimum (inclusive) R, G and B values. A pixel must have R,G, and B all greater than or equal to crLower and less than or equal to crUpper to be included in the region.

crUpper

COLORREF that contains the maximum (inclusive) R,G, and B values. A pixel must have R,G, and B all greater than or equal to crLower and less than or equal to crUpper to be included in the region.

uCombineMode

The action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function uses the RGB color model to set a region based on a color range.

To be added to the region a color must fall in the range crLower..crUpper. To set a region for all pure red, specify crLower and crUpper as follows:

crLower RGB(1,0,0)

crUpper(255,0,0)

Note that this would fail to include many colors that look red to the eye (like RGB(255,4,4)). To include ALL shades of red, you can use L_SetBitmapRgnColorHSVRange.

To update an existing region, specify how the new region is to be combined with the existing one. For descriptions of the possibilities, refer to Creating a Bitmap Region.

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.

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 only in the Document/Medical toolkits.

Required DLLs and Libraries

LTDIS

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

Windows 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_RemapBitmapHue, L_SetBitmapRgnColorHSVRange, L_RGBtoHSV, L_HSVtoRGB, L_SetBitmapRgnEllipse, L_SetBitmapRgnPolygon, L_SetBitmapRgnRect, L_SetBitmapRgnRoundRect

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Region Processing

 

Creating a Bitmap Region

 

Working with the Existing Bitmap Region

 

Using Color Values in LEADTOOLS

 

Saving a Region

Example

//This example sets a region corresponding to all colors that 
//have an rgb that includes red but no green and no blue

L_INT ExampleSetRGBRgn(pBITMAPHANDLE pBitmap)
{
   COLORREF rgbLo, rgbHi;
   L_INT nRet;
   
   rgbLo = RGB(1,0,0);
   rgbHi = RGB(255,0,0);
   
   nRet = L_SetBitmapRgnColorRGBRange(
      pBitmap,
      rgbLo,
      rgbHi,
      L_RGN_SET);
   return nRet;
}