virtual L_INT LBitmap::SampleTarget (crSample, crTarget, uFlags)
Corrects color values by shifting the sample colors to the target colors.
The COLORREF value that specifies the Sample color. The red value for red channel, green value for green channel, blue value for blue channel.
The COLORREF value that specifies the Target color. The red value for red channel, green value for green channel, blue value for blue channel.
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.
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. |
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document