This method allows you to convert a range in colors in a raster image into one color. This method is useful when using transparent colors.

[Visual Basic] Public Function UnifyColor(red As Byte, green As Byte, blue As Byte, error As Integer) As Boolean
[C#] public bool UnifyColor(byte red, byte green, byte blue, int error);

Parameters

red
   The red component of the color to be unified (from 0 to 255)

green
   The green component of the color to be unified (from 0 to 255)

blue
   The blue component of the color to be unified (from 0 to 255)

error
   Sets the range of RGB values that will be unified (from 0 to 255)

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The UnifyColor method allows you to unify a range of colors in a raster image. This is very useful when using transparancy. The Red, Green, and Blue parameters define the unified color. The Error parameter sets the range of colors that will be unified into the single color. So, for example, if you set the Red, Green and Blue parameter each to 128 and the Error parameter to 10, all colors ranging from RGB(118,118,118) to RGB(138,138,138) will be changed to RGB(128,128,128).

To execute the UnifyColor method, set the image handle of the image in the Image property or the Layer(LayerNumber).Image property. The UnifyColor method supports 8 bit grayscale, 16, 24, and 32 bit images.

Before executing the UnifyColor method, you must set the area on the image that will be affected. There are 4 ways to do this.

  1. To use a mask image, set the SelectMode property to EffectMask. Set the mask image handle in the SourceMask property
  2. To process the total image, set the SelectMode property to EffectAll
  3. To process the polygonal area on the image, set the SelectMode property to EffectPolygon. Select the polygon by setting the appropriate coordinate values for the points of the polygon in the Point property
  4. To process an elliptical area on the image, set the SelectMode property to EffectEllipse. Select the ellipse by setting the appropriate values for the bounding rectangle in the Rect property

When the SelectMode property is set to EffectPolygon or EffectEllipse, the appropriate values must be set in the Inside property. When a 1, 4, or 8 bit image is processed, the total image will be processed regardless of the value set in the SelectMode property.

If the UnifyColor method is successful and the DestinationAsImageKitImage property is True, the resulting image will be set in the Image property or in the Layer(LayerNumber).Image property, according to the value set in the LayerNumber property.

If the UnifyColor method is successful and the DestinationAsImageKitImage property is False, the resulting image will be set in the DestinationImage property.

See Also

ImageKit.Effect Members | Newtone.ImageKit.Wpf.ImageKit

The ImageKit WPF is created by Newtone Corporation