LBitmapBase::CreateFadedMask

Summary

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.

Syntax

#include "ltwrappr.h"

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

Parameters

LBitmapBase * pMaskBitmap

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

L_UINT uStructSize

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

L_INT nLength

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

L_INT nFadeRate

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

L_INT nStepSize

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

L_INT nInflate

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

L_UINT 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

L_INT nMaxGray

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

COLORREF crTransparent

COLORREF variable that contains the transparency color.

Returns

Value Meaning
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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

For an example, refer to LBitmapBase::FeatherAlphaBlend.

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.