GrayScaleToMultitone Method (ILEADRasterProcess)

Visual Basic example

Visual C++ example

 

Syntax

short GrayScaleToMultitone (ILEADRaster * pRaster, MultitoneTypeConstants ToneType, MultitoneDistTypeConstants DistType, ReplaceColorsConstants Flags);

Overview

Refer to Grayscale Images

Remarks

(Raster Pro and above toolkits.) Converts a grayscale bitmap into a colored one by mixing or replacing the original values of the pixels with one or more new colors.

This method was designed for use with grayscale bitmaps. If the bitmap being used is not grayscale, this method only affects those pixels or areas of the bitmap where Red=Green=Blue.

Monotone conversion is possible by setting Flags to DT_REPLACE, which clears the palette.

This method gives you the option of having the toolkit generate the array of colors to use or creating the array of colors to use yourself.

To have the toolkit generate the array of colors:

a.

If the bitmap is binary, call GrayScaleToMultitone with ToneType set to DT_MONOTONE, DistType set to DT_LINEAR and the color you wish to use set in MultitoneColors property. The IsGrayScale property will be called by GrayScaleToDuotone to determine the kind of grayscale palette being used. If IsGrayScale returns GRAY_ORDEREDINVERSE or GRAY_NOTORDERED, then the color passed in the MultitoneColors property parameter to GrayScaleToMultitone will become the first color in the array generated by the toolkit, and the toolkit will create the second color in the array. The MultitoneColors property will be updated with these two colors.

 

If IsGrayScale property returns a value other than GRAY_ORDEREDINVERSE or GRAY_NOTORDERED, then the color passed in the MultitoneColors property to GrayScaleToMultitone will become the second color in the array generated by the toolkit, , and the toolkit will create the first color in the array. The MultitoneColors property will be updated with these two colors.

b.

If the bitmap is grayscale (not binary) call GrayScaleToMultitone with

 

DistType set to DT_LINEAR. The GrayScaleToMultitone method will take the color(s) passed to it in the MultitoneColors property and generate a 256 color gradient for each color.

 

(i)

If the ToneType is set to DT_DUOTONE, set two colors in the MultitoneColors property. The toolkit will create a 256 color array for each color. The MultitoneColors property array will be updated with all 512 colors.

 

(ii)

If the ToneType is set to DT_TRITONE, set three colors in the MultitoneColors property. The toolkit will create a 256 color array for each color. The MultitoneColors property will be updated with all 768 colors.

 

(iii)

If the ToneType is set to DT_QUADTONE, set four colors in the MultitoneColors property. The toolkit will create a 256 color array for each color. The MultitoneColors property will be updated with all 1024 colors.

c.

If the bitmap is not grayscale (it is color) call GrayScaleToMultitone with DistType set to DT_LINEAR. The GrayScaleToMultitone method will take the color(s) passed to it in the MultitoneColors property and generate a 256 color gradient for each color. (See the expanded explanation in i, ii and iii of (b) above.) These colors will be used to change only those pixels in the color image for which Red = Green = Blue.

To use a user-defined array of colors:

a.

If the bitmap is binary, call GrayScaleToMultitone with ToneType set to DT_MONOTONE, DistType set to DT_USER and the two colors you wish to use in the MultitoneGradient property parameter.

b.

If the bitmap is grayscale (not binary) call GrayScaleToMultitone with DistType set to DT_USER.

 

(i)

If the ToneType is set to DT_DUOTONE, set 512 colors (256 for each basic color) in the MultitoneGradient property.

 

(ii)

If the ToneType is set to DT_TRITONE, set 768 colors (256 for each basic color) in the MultitoneGradient property.

 

(iii)

If the ToneType is set to DT_QUADTONE, set 1024 colors (256 for each basic color) in the MultitoneGradient property.

c.

If the bitmap is not grayscale (it is color) call GrayScaleToMultitone with DistType set to DT_USER. (See the expanded explanation in i, ii and iii of (b) above.) These colors will be used to change only those pixels in the color image for which Red = Green = Blue.

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

See Also

Elements:

GrayScale method, GrayScaleToDuotone method, GrayScaleGreen property, GrayScaleRed property, GrayScaleBlue property

Topics:

Raster Image Functions: Doing Color Expansion or Reduction