ImageEn, unit iexBitmaps

TIEBitmap.SetColorFromAlpha

TIEBitmap.SetColorFromAlpha


Declaration

procedure SetColorFromAlpha(MinAlpha, MaxAlpha: Integer; Color: TColor); overload;
procedure SetColorFromAlpha(MinAlpha, MaxAlpha: Integer; RGB: TRGB); overload;


Description

Sets a color for each pixel in specified alpha range. Works only with ie24RGB pixel format.

Note: You may want to call RemoveAlphaChannel afterwards


Examples

// Each pixel that is fully transparent (alpha=0) will be colored black
aBmp.SetColorFromAlpha( 0, 0, clBlack );
aBmp.RemoveAlphaChannel();

// Loads an image with an alpha channel, paint all transparent pixels (0...254 alpha values) as White, then save as jpeg (which does not support an alpha channel)
ImageEnView.IO.LoadFromFile('C:\test.png');
ImageEnView.IEBitmap.SetColorFromAlpha(0, 254, CreateRGB(255, 255, 255));
ImageEnView.IO.SaveToFile('C:\output.jpg');