GrayScaleToDuotone method (ILEADRasterProcess)

Visual Basic example

Visual C++ example

 

Syntax

short GrayScaleToDuotone (ILEADRaster * pRaster, OLE_COLOR crColor, long lFlags);

Overview

Refer to Grayscale Images

Remarks

(Raster Pro and above toolkits) Converts the grayscale bitmap into a colored one by mixing or replacing the original values of the pixels with 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.

This method transforms the 8-bit grayscale bitmaps into colored 8-bit bitmaps (Palette) meanwhile the 12-bit and 16-bit grayscale bitmaps are transformed into a 48-bit colored bitmap.

Monotone conversion is possible by setting lFlags 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:

 

Pass the color to use for generating the array of gradient colors in the crColor parameter.

 

(a) If the bitmap is binary, the IsGrayscale property is checked by the GrayScaleToDuotone method to determine the kind of grayscale palette being used. If the IsGrayscale property is GRAY_ORDEREDINVERSE or GRAY_NOTORDERED, then the color passed in the crColor parameter to the GrayScaleToDuotone method will become the first color in the array generated by the toolkit. The red, green and blue components of each color are stored in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties, respectively.

 

If the IsGrayscale property contains a value other than GRAY_ORDEREDINVERSE or GRAY_NOTORDERED, then the color passed in the crColor parameter to GrayScaleToDuotone method will become the second color in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue arrays generated by the toolkit, and the toolkit will create the first color in the properties.

 

(b) If the bitmap is grayscale (not binary) the GrayScaleToDuotone method will take the color passed to it in the crColor parameter and generate a 256 color gradient in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties.

 

(c) If the bitmap is not grayscale (it is color) then the GrayScaleToDuotone method will use the color passed to it in the crColor parameter and generate a 256 color gradient in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties. 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 the GrayScaleToDuotone method with the two colors you wish to use in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties.

 

(b) If the bitmap is grayscale (not binary) call the GrayScaleToDuotone method with the 256 colors you wish to use in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties.

 

(c) If the bitmap is not grayscale (it is color) call the GrayScaleToDuotone method with the 256 colors you wish to use in the GrayScaleRed, GrayScaleGreen and GrayScaleBlue properties. 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.

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:

GrayScale method, GrayScaleToMultitone method, GrayScaleGreen property, GrayScaleRed property, GrayScaleBlue property

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Using Color Values in LEADTOOLS