Table of Contents

Method ConvertAlphaToMask

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

ConvertAlphaToMask(byte)

If the image has alpha channel, this method converts it to mask.

public virtual bool ConvertAlphaToMask(byte threshold = 128)

Parameters

threshold byte

Returns

bool

Returns true on success, false on error.

Remarks

If the image has an alpha channel, all pixels with alpha value less than threshold are replaced with the mask color and the alpha channel is removed. Otherwise nothing is done.

ConvertAlphaToMask(RGBValue, byte)

If the image has alpha channel, this method converts it to mask using the specified color as the mask color.

public virtual bool ConvertAlphaToMask(RGBValue rgb, byte threshold = 128)

Parameters

rgb RGBValue

Mask color.

threshold byte

Pixels with alpha channel values below the given threshold are considered to be transparent, i.e.the corresponding mask pixels are set. Pixels with the alpha values above the threshold are considered to be opaque.

Returns

bool

Returns true on success, false on error.

Remarks

If the image has an alpha channel, all pixels with alpha value less than threshold are replaced with the mask color and the alpha channel is removed.Otherwise nothing is done.