LBitmap::SampleTarget

Summary

Corrects color values by shifting the sample colors to the target colors.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmap::SampleTarget (crSample, crTarget, uFlags)

Parameters

COLORREF crSample

The COLORREF value that specifies the Sample color. The red value for red channel, green value for green channel, blue value for blue channel.

COLORREF crTarget

The COLORREF value that specifies the Target color. The red value for red channel, green value for green channel, blue value for blue channel.

L_UINT uFlags

Flags that indicates the channel for which to shift the color and how to remap the other values for that channel. You can use a bit wise OR ( | ) to specify one flag from each group.

The following are the flags that indicate the channel:

Value Meaning
SAMP_RED [0x0001] Shift the color in the red channel.
SAMP_GREEN [0x0002] Shift the color in the green channel.
SAMP_BLUE [0x0003] Shift the color in the blue channel.
SAMP_RGB [0x0004] Shift the color in the red, green, and blue channels.

The following are the flags that indicate how other pixel values in the set channel will be affected:

Value Meaning
SAMP_LOW [0x0010] Remap the shadow values for the channel set in uFlags.
SAMP_MID [0x0020] Remap the midtone values for the channel set in uFlags.
SAMP_HIGH [0x0030] Remap the highlight values for the channel set in uFlags.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

For example, suppose you are working with a color image. In crSample you set the red value portion of the COLORREF structure to 125, the green portion to 165 and the blue portion to 100. In crTarget you set the red value portion to 170, the green to 120 and the blue to 200. If you set SAMP_BLUE in uFlags, then for every pixel in the bitmap that has a blue value of 100, that blue value will be changed to 200, thus shifting the colors in the bitmap. Depending on whether you set SAMP_LOW, SAMP_MID, or SAMP_HIGH, either the shadow values in the blue channel will be remapped, or the midtone values in the blue channel will be remapped, or the highlight values in the blue channel will be remapped.

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.

For gray scale bitmaps the gray value of the crSample and crTarget are used, and the different channel flags have the same effect since it works on the same channel (gray channel).

Support for 12 and 16-bit grayscale images are available only in the Document/Medical toolkits.

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

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 does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Sample Target Function - Before

Sample Target Function - Before

Sample Target Function - After

Sample Target Function - After

View additional platform support for this Sample Target function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

The following example applies the sample target function:

L_INT LBitmap__SampleTargetExample(LAnimationWindow *BitmapWindow)  
{ 
 
   return BitmapWindow->SampleTarget(RGB(50, 100, 150), RGB(20, 10 , 100), SAMP_RED| SAMP_MID);  
 
} 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 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.