ImageEn, unit iexBitmaps

TIEBitmap.AlphaFill

TIEBitmap.AlphaFill


Declaration

procedure AlphaFill(Value: Byte; Scaled: Boolean = False); overload;
procedure AlphaFill(StartValue, EndValue: Byte; Direction: TIEGradientDir = gdVertical); overload;


Description

Sets the transparency of the alpha channel. Either filling the entire alpha channel to a single value, or graduating from one value to another (gradient transparency).
If Scaled = True, then pixels that are already partially transparent will be scaled in the ratio of Value/255.

0 is transparent, 255 is opaque, 1 - 254 are partially transparent.




Example

// Set image as fully transparent
IEBitmap.AlphaFill( 0 );


// Set image as fully opaque
IEBitmap.AlphaFill( 255 );


// Halve the alpha (Double the transparency) of all pixels (fully opaque pixels will become 50%, partially opaque ones will becomes <50%)
IEBitmap.AlphaFill( 128, True );


// If used with TImageEnView, ensure Update() is called
ImageEnView1.IEBitmap.AlphaFill( 128 );
ImageEnView1.Update();


// Set image as 50% transparent
IEBitmap.AlphaFill( 128 );


// Graduate the transparency from fully transparent on the top to fully opaque on the bottom
IEBitmap.AlphaFill( 0, 255, gdVertical );




// Gradient fill the alpha channel with fully transparent on the left to fully opaque on the right
ImageEnView1.Proc.AlphaFill( 0, 255, gdHorizontal );




See Also

Alpha
AlphaChannel
AlphaFillRect
Fill
FillRect
GradientFill
GradientFillRect