ChannelMix method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int ChannelMix(int nRedFactorR, int nRedFactorG, int nRedFactorB, int nRedFactorConstant, int nGreenFactorR, int nGreenFactorG, int nGreenFactorB, int nGreenFactorConstant, int nBlueFactorR, int nBlueFactorG, int nBlueFactorB, int nBlueFactorConstant);

Delphi Syntax

Function ChannelMix (nRedFactorR: L_INT; nRedFactorG: L_INT; nRedFactorB: L_INT; nRedFactorConstant: L_INT; nGreenFactorR: L_INT; nGreenFactorG: L_INT; nGreenFactorB: L_INT; nGreenFactorConstant: L_INT; nBlueFactorR: L_INT; nBlueFactorG: L_INT; nBlueFactorB: L_INT; nBlueFactorConstant: L_INT ): L_INT;

Overview

Refer to Correcting Colors

Remarks

Redistributes the RGB values of the specified bitmap using the specified parameters.

This method is used to rebalance the colors in a bitmap. It can be used to make color adjustments and corrections.

This method supports 1, 2, 3, 4, 5, 6, 7, 8, 24 and 48 bit bitmaps and can support regions for 24 and 48 bit bitmaps. If the bitmap has a region, the effect will be applied on the region only.

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.

As an example, if the ChannelMix method is called with the following values:

nRedFactorR: 100.

nRedFactorG: -200.

nRedFactorB: 50.

nRedFactorConstant: 50

nGreenFactorR: 150

nGreenFactorG: 50

nGreenFactorB: 50.

nGreenFactorConstant: -50.

nBlueFactorR: 100

nBlueFactorG: 50

nBlueFactorB: -150

nBlueFactorConstant: 25.

A pixel with the RGB value (130, 200, 50) would be modified as follows:

New Red value = 130(100%) + 200(-200%) + 50(50%) + ( 50 X MaximumComponent i.e. 255 for an 8 bit component and 65536 for a 16 bit component) / 100 = 128

                         = 130 - 400 + 25 + 128 

                         = -117   (negative values will be set to 0 in the final RGB value)

New Green value = 130(150%) + 200(50%) +50(50%) -  ( 50 X MaximumComponent i.e. 255 for 8 bit component and 65536 for 16 bit component) / 100 = 128

                                 195 + 100 + 25 - 128 

                             =  192

New Blue value = 130(100%) + 200(50%) + 50(-150%) +  ( 25 X MaximumComponent i.e. 255 for 8 bit component and 65536 for 16 bit component) / 100 = 64

                          = 130 + 100 - 75 +  64

                          =  219 

Therefore the new RGB value for the pixel is: (0, 192, 219).

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:

ConvertToColoredGray method, BalanceColors method, GrayScale method, GrayScaleExt method, IsGrayScale property

Topics:

Raster Images: Modifying Intensity Values