LBitmap::SampleTarget

#include "ltwrappr.h"

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

COLORREF crSample;

/* sample color */

COLORREF crTarget;

/* target color */

L_UINT uFlags;

/* flags */

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

Parameter

Description

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.

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.

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

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.

Required DLLs and Libraries

LTIMGCLR

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::AdjustTint. LBitmap::ColorHalfTone, LBitmap::IntensityDetect, LBitmap::SpatialFilter, LBitmap::BinaryFilter, LBitmap::MaxFilter, LBitmap::MinFilter, LBitmap::AddNoise, LBitmap::Emboss, LBitmap::Mosaic, LBitmap::MotionBlur, LBitmap::Oilify, LBitmap::Posterize, LBitmap::RemoveRedeye, LBitmap::Solarize, LBitmapBase::Underlay, LBitmap::BumpMap, LBitmap::Cubism, LBitmap::DrawStar, LBitmap::Dry, LBitmap::FreePlaneBend, LBitmap::FreeRadBend, LBitmap::GlassEffect, LBitmap::GlowFilter, LBitmap::LensFlare, LBitmap::Light, LBitmap::Ocean, LBitmap::PlaneBend, LBitmap::Plane, LBitmap::SampleTarget, LBitmap::Tunnel, LBitmap::Bending, LBitmap::Cylindrical, LBitmap::FreeHandShear, LBitmap::FreeHandWave, LBitmap::Impressionist, LBitmap::Pixelate, LBitmap::Polar, LBitmap::Punch, LBitmap::RadialBlur, LBitmap::RadWave, LBitmap::Ripple, LBitmap::Spherize, LBitmap::Swirl, LBitmap::Wave, LBitmap::Wind, LBitmap::ZoomBlur, LBitmap::ZoomWave

Topics:

Raster Image Functions: Artistic Effects

 

Applying Artistic Effects

 

Using Color Values in LEADTOOLS

 

Raster Image Functions: Correcting Colors

 

Raster Image Functions: Correcting Colors

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); 
}