ImageEn, unit iexBitmaps

TIEBitmap.SyncAlphaChannel

TIEBitmap.SyncAlphaChannel


Declaration

procedure SyncAlphaChannel(AntiAlias: Boolean = True);


Description

If you have manually loaded or set the AlphaChannel, calling this method will ensure it matches the size of the image and has a pixelformat of ie8g (alpha channels with invalid sizes or color depths will not display).
AntiAlias specifies that a Bicubic filter is used if the alpha channel needs to be stretched (which will create a range of transparency values). Set to false to ensure an alpha channel with only 0 and 255 values (i.e. full alpha or full opaque pixels) will not have semi-transparent pixels.



Note: Use Negative to invert the alpha channel (i.e. so black pixels become opaque and white transparent)


Example

// Assign an alpha channel to an image using a source file
// For simple transparency, use a monochrome bitmap where the black pixels will become transparent
// Otherwise, a 256 color gray-scale image can provide a range of tranparency values (from white/fully opaque to black/fully transparent)
aBMP := TIEBitmap.create( 'D:\alpha.bmp' );

// Use our bitmap as the alpha channel
ImageEnView1.IEBitmap.AlphaChannel.Assign( aBMP );

// Ensure size of alpha channel matches size of image (and is ie8g)
ImageEnView1.IEBitmap.SyncAlphaChannel();

// Update the container
ImageEnView1.Update();

aBMP.free;


Source Image




Alpha Image (Black will become transparent, gray will be 50% transparent and white will be fully opaque)




Result (on a white TImageEnView)




See Also

 AlphaChannel
 DetachAlphaChannel
 ReplaceAlphaChannel