Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LBitmapBase::CreateFadedMask

Show in webframe

#include "ltwrappr.h"

virtual L_INT LBitmapBase::CreateFadedMask(pMaskBitmap, uStructSize, nLength, nFadeRate, nStepSize, nInflate, uFlag, nMaxGray, crTransparent)

LBitmapBase * pMaskBitmap;

/* pointer to an LBitmapBase object */

L_UINT uStructSize;

/* size of the structure pointed to by pMaskBitmap */

L_INT nLength;

/* extent of the fade */

L_INT nFadeRate;

/* fade rate */

L_INT nStepSize;

/* step size */

L_INT nInflate;

/* expansion value */

L_UINT uFlag;

/* flag */

L_INT nMaxGray;

/* maximum value of the fade color */

COLORREF crTransparent;

/* transparent color */

Creates a fade mask bitmap in which the color of each pixel is changed with respect to its position in the bitmap. This change depends on the fade rate.

Parameter

Description

pMaskBitmap

Pointer to an LBitmapBase object that contains a 24-bit bitmap in which the fade mask will be created.

uStructSize

Size in bytes, of the structure pointed to by pMaskBitmap. Use sizeof(BITMAPHANDLE).

nLength

Value that represents the extent of the fade, in pixels.

nFadeRate

Value that represents the rate at which the color will fade with each step. Values are between 0 and 255.

nStepSize

Step size at which the color will change. This value is in pixels.

nInflate

Value that indicates the amount to expand the resulting bitmap. This parameter is used only if FADE_OUTER is set in uFlags.

uFlag

Flags that indicate how the fade mask will be created. Possible values are:

 

Value

Meaning

 

FADE_OUTER

[0x0001] If this flag is set, the fade will be outside the bitmap's region. If this flag is not set, the fade will be inside the bitmap's region.

 

FADE_DUMPFILL

[0x0002] If this flag is set, the dump part of the mask will be filled with the dump color. The FADE_FILLCOLOR_START and FADE_WHITETOBLACK flags determine the dump color. If this flag is not set, the dump part is filled with the crTransparent color.

 

FADE_FILLCOLOR_START

[0x0004] If this flag is set, the dump color is the color used at the start of the fade. The start color may be white or black, based on the FADE_WHITETOBLACK. If this flag is not set, the dump color is the color at the end of the fade. If the FADE_DUMPFILL flag is not set, this flag is ignored.

 

FADE_WHITETOBLACK

[0x0008] If this flag is set, the fade starts with white and changes toward black. If this flag is not set, the fade changes from black to white.

 

FADE_NOTRANSPARENCY

[0x0010] If this flag is set, fill the transparency part with a color other than crTransparency. The color is either the same as the dump color, or its opposite, depending on whether the FADE_TRANSPARENCY_DUMPCOLOR flag is set. If the FADE_NOTRANSPARENCY flag is not set, fill the transparency with crTransparency. If the FADE_DUMPFILL flag is not set, this flag is ignored.

 

FADE_TRANSPARENCY_DUMPCOLOR

[0x0020] If this flag is set, the transparency color is the same as the dump color. If this flag is not set, the transparency color is the opposite of the dump color. This flag is used only if FADE_NOTRANSPARENCY is set

nMaxGray

The maximum value of the fade color. Possible values are between 0 and 255.

crTransparent

COLORREF variable that contains the transparency color.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is concerned with the size and shape of the region, not the bitmap itself. Therefore, any bitmap with a region can be used to create a fade mask bitmap. The fade mask bitmap can be used by the LBitmapBase::FeatherAlphaBlend function to combine two bitmaps with feathering.

If the FADE_OUTER flag is not set, then the size of the fade mask bitmap is equal to the size of a region and the fade progresses toward the center of the region. If the FADE_OUTER flag is set, the size is equal to the size of region plus the nInflate value and the fade starts at the edge of the region and progresses toward the edge of the fade mask bitmap. (The nInflate parameter is used only with FADE_OUTER flag)

In order to use the fade mask bitmap in the LBitmapBase::FeatherAlphaBlend function, the fade mask bitmap must contain three portions:

a)

A portion in which the output (from the blending function) will be the same as the destination bitmap. This is called the Transparency portion of the mask. It is filled with black.

b)

A portion in which the output is a combination of the destination and source bitmap.

c)

A portion in which the output comes from the source bitmap. This is called the Dump portion of the mask. It is filled with white.

To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallback.

For examples of fade masks created using various flags, refer to Using the LBitmapBase::CreateFadedMask 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.

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 32-bit grayscale images.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMGEFX

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

Win32, x64.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, LBitmapBase::Underlay, LBitmapBase::Combine, LBitmapBase::FeatherAlphaBlend, LBitmapBase::AlphaBlend, Class Members

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

Using Color Values in LEADTOOLS

 

Using the LBitmapBase::CreateFadedMask Function

 

Raster Image Functions: Processing an Image

Example

For an example, refer to LBitmapBase::FeatherAlphaBlend.

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.