L_ColorBitmapRgn

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ColorBitmapRgn(hDC, pBitmap, pXForm, crRgnColor)

HDC hDC;

/* handle to the device context for display */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap */

pRGNXFORM pXForm;

/* pointer to a coordinate translation structure */

COLORREF crRgnColor;

/* color value */

Highlights a region by displaying a filled, color representation of the region.

Parameter

Description

hDC

Handle to a device context where the image is displayed and where the frame is to appear.

pBitmap

Pointer to the bitmap handle referencing the bitmap that has the region.

pXForm

Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

 

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the bitmap's view perspective.

crRgnColor

Color value to be XORed with colors within a region to determine the new colors for displaying the region. The color corresponding to a particular part of the region is determined as follows:

 

Region Color Displayed = (color of pixel in region) XOR (crRgnColor)

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is particularly useful when displaying regions with black and white images. All black pixels in a region are displayed with color crRgnColor, and all white pixels are displayed ~(crRgnColor). For example, suppose that crRgnColor is light green (BGR 0x80FF40). All black pixels in the region are displayed as crRgnColor. All white pixels in the region are displayed as 0xFFFFFF XOR 0x80FF40 = 0x7F00BF, which is purple.

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_FrameBitmapRgn()

Topics:

Raster Image Functions: Displaying Images

 

Defining and Using a Bitmap Region

 

Using Color Values in LEADTOOLS

Example

//The following should be part of the WM_PAINT processing
L_VOID ColorRegionExample(HWND hWnd, pBITMAPHANDLE pBitmap)
{
   HDC         hdcDraw;   
   COLORREF    crRgnColor = RGB(255,0,0);
   
   if(L_BitmapHasRgn(pBitmap))
   {
      hdcDraw = GetDC(hWnd);
      L_ColorBitmapRgn(hdcDraw, pBitmap, NULL, crRgnColor);
      ReleaseDC(hWnd, hdcDraw);
   }
}