L_BalanceColors

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_BalanceColors(pBitmapHndl, pRedFact, pGreenFact, pBlueFact)

pBITMAPHANDLE pBitmapHndl;

/* pointer to the bitmap handle */

BALANCING L_FAR * pRedFact;

/* pointer to a structure */

BALANCING L_FAR * pGreenFact;

/* pointer to a structure */

BALANCING L_FAR * pBlueFact;

/* pointer to a structure */

Redistributes the RGB values of the specified bitmap, using the values stored in the specified structures.

Parameter

Description

pBitmapHndl

Pointer to the bitmap handle that references the bitmap in which to balance the colors.

pRedFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's red values.

pGreenFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's green values.

pBlueFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's blue values.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For each pixel in the bitmap, the red value is modified using the values pointed to by pRedFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the green value is modified using the values pointed to by pGreenFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the blue value is modified using the values pointed to by pBlueFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

The intermediate red values are added to generate the new red value for the pixel. The intermediate green values are added to generate the new green value for the pixel and the intermediate blue values are added to generate the new blue value for the pixel. This triplet forms the new RGB value for the pixel.

The Balancing structure has three components of type double: toRed, toGreen and toBlue. The possible values of each member must be within the range: 0.0 – 1.0.

This function supports 48 and 64-bit colored images.

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

LTIMG

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_ConvertToColoredGray, L_GrayScaleBitmap, L_GrayScaleBitmapExt, L_IsGrayScaleBitmap, L_AdjustBitmapTint, L_ColorHalfToneBitmap

Topics:

Correcting Colors

 

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Correcting Colors

Example

/* This example assumes there is a bitmap loaded into Bitmap, which is of type BITMAPHANDLE. */
BITMAPHANDLE Bitmap;
BALANCING RedFact, GreenFact, BlueFact;
RedFact.uStructSize   = sizeof(BALANCING);
RedFact.toRed=0.25;
RedFact.toGreen=0.50;
RedFact.toBlue=0.25;
GreenFact.uStructSize = sizeof(BALANCING);
GreenFact.toRed=0.30;
GreenFact.toGreen=0.40;
GreenFact.toBlue=0.30;
BlueFact.uStructSize  = sizeof(BALANCING);
BlueFact.toRed=0.10;
BlueFact.toGreen=0.60;
BlueFact.toBlue=0.30;
L_BalanceColors
(&Bitmap,&RedFact,&GreenFact,&BlueFact);