LBitmapRgn::SetRgnColor
#include "ltwrappr.h"
virtual L_INT LBitmapRgn::SetRgnColor(crColor)
COLORREF crColor; |
/* color to use for the region */ |
Creates or updates the associated class object's bitmap region by adding a region that consists of all the pixels of a specified color.
Parameter |
Description |
crColor |
The COLORREF value that specifies the color to use for the region. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
You specify the color using a COLORREF value, which is a Windows-defined data type. You can assign the value using the Windows RGB macro.
To update an existing region, you specify how the new region is to be combined with the existing one. For descriptions of the possibilities, refer to Creating a Bitmap Region.
You can use this function to simulate the use of a transparent color as follows:
1. |
Set L_RGN_SETNOT for the CombineMode using LBitmapRgn::SetRgnCombineMode function, then call the LBitmapRgn::SetRgnColor function, with the transparent color in the crColor parameter. |
2. |
Call the LPaint::PaintRgnDC function to paint the resulting region, which includes everything in the bitmap, except the transparent color. |
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
Example
L_INT LBitmapRgn__SetRgnColorExample() { L_INT nRet; LBitmapBase MyBitmap(200,300,ORDER_BGR); nRet =MyBitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.cmp")); if(nRet !=SUCCESS) return nRet; LBitmapRgn Region(&MyBitmap); //set the red color as a region nRet =Region.SetRgnColor(RGB(255,0,0)); if(nRet !=SUCCESS) return nRet; return SUCCESS; }