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.

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.

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

Elements:

LBitmapRgn::SetRgnEllipse, LBitmapRgn::SetRgnPolygon, LBitmapRgn::SetRgnRect, LBitmapRgn::SetRgnRoundRect, LBitmapRgn::SetRgnColorHSVRange, LBitmapRgn::SetRgnColorRGBRange, Class Members

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Region Processing

 

Defining and Using a Bitmap Region

 

Using Color Values in LEADTOOLS

 

Saving a Region

Example

L_VOID TestFunction()
{
   LBitmapBase MyBitmap(200,300,ORDER_BGR);

   MyBitmap.Load(TEXT("image1.cmp"));
   LBitmapRgn Region(&MyBitmap);

   Region.SetRgnColor(RGB(255,0,0)); //set the red color as a region
}