LBitmapRgn::SetRgnColorRGBRange
#include "ltwrappr.h"
virtual L_INT LBitmapRgn::SetRgnColorRGBRange(crLower, crUpper)
COLORREF crLower; |
/* minimum RGB color value */ |
COLORREF crUpper; |
/* maximum RGB color value */ |
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 |
crLower |
COLORREF value 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 value 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. |
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 LBitmapRgn::SetRgnColorHSVRange.
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. |
See Also
Functions: |
LBitmap::RemapHue, LBitmapRgn::SetRgnEllipse, LBitmapRgn::SetRgnPolygon, LBitmapRgn::SetRgnRect, LBitmapRgn::SetRgnRoundRect |
Topics: |
|
|
|
|
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 SetRGBRgnExample(LBitmapRgn& rgn)
{
COLORREF rgbLo, rgbHi;
L_INT nRet;
rgbLo = RGB(1,0,0);
rgbHi = RGB(255,0,0);
nRet = rgn.SetRgnColorRGBRange(rgbLo,rgbHi);
return nRet;
}