ColorThreshold Method (ILEADRasterProcess)

Visual Basic example

Visual C++ 5.0 example

 

Syntax

short ColorThreshold (ILEADRaster* pRaster, ColorThresholdConstants ColorSpace);

Overview

Refer to Correcting Colors

Remarks

Resets those bitmap pixel component values that fall outside of a specified range, using any one of eight color spaces.

This method is similar to the ConvertColorSpace method but provides greater flexibility by allowing the specification of a range and different options for handling those values that fall outside of the range.

This method works as follows:

The bitmap is converted to the required color space.

For every pixel, the following operations are performed: Each component is compared with the ComponentMinRange and ComponentMaxRange properties

If it is inside the range, the component is considered to have "passed" the test.

If it is outside the range, the component has been rejected". The CLTH_TYP_BANDREJECT flag inverts this by making "rejected" components "passed" and vice versa.

If CLTH_MOD_CHANNEL is set, the components are modified independently. If CLTH_MOD_ALL has been passed, the pixel is rejected by the test if any component is rejected. If the pixel/component is rejected, then:

If CLTH_VALUE_MIN is passed, the rejected pixel/component is set to 0.

If CLTH_VALUE_MAX is passed, the rejected pixel/component is set to 255.

If CLTH_VALUE_CLAMP is passed, components less that ComponentMinRange go to 0 and components greater than ComponentMaxRange go to 255. This would work only with the CLTH_MOD_CHANNEL and CLTH_TYP_BANDPASS flag.

This method works for 1, 2, 3, … 8,16, 24, 32, 48 and 64-bit color bitmaps and can support regions for 24 and 48-bit bitmaps. If a 24 or 48-bit bitmap has a region the effect will be applied on the region only.

One structure is used for each color component. The order is considered to be the same as in the CLTH_xxx_SPACE name. For example, for CLTH_RGB_SPACE:

ComponentXXX(0)is used for the Red component

ComponentXXX(1)is used for the Green component

ComponentXXX(2)is used for the Blue component

This method 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 method.

See Also

Elements:

ComponentMaxRange property, ComponentMaxRange property, ComponentFlags property, ColorSeparate method, ColorMerge method, AddShadow method, HueSaturationIntensity method, ColorReplace method, MathFunction method, RevEffect method

Topics:

Raster Images: Modifying Intensity Values

 

Raster Images: Doing Color Space Conversions