ImageEn, unit imageenproc

TImageEnProc.FeatherAlphaEdges

TImageEnProc.FeatherAlphaEdges


Declaration

procedure FeatherAlphaEdges(FeatherDepth : Integer);


Description

Apply a feathering effect to the image. Feathering softens the edges of an image by applying alpha transparency at a rate that is proportional to the distance to the edge (specifically, adding a gradient in the alpha channel).

FeatherDepth specifies the depth in pixels of the feather effect. The range is 0 to 255, with typical values of 2 to 5. If iFeatherDepth = 0 then the image is not feathered but a simple smoothing filter is applied to reduce the jagged edges of the image.

Note: Method has no effect if the image does not have an alpha channel


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Feather edges of a transparent GIF
ImageEnView1.IO.LoadFromFile( 'D:\image.gif' );
ImageEnView1.Proc.FeatherAlphaEdges(5);


// Make colors similar to white transparent and then feather the alpha edges
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );



ImageEnView1.Proc.SetTransparentColors( CreateRGB( 156, 156, 156 ), CreateRGB( 255, 255, 255 ), 0 );
ImageEnView1.Proc.FeatherAlphaEdges( 10 );




// Feather the border of a JPEG image
ImageEnView1.IO.LoadFromFile( 'D:\image.jpg' );
ImageEnView1.IEBitmap.AlphaChannel; // Add alpha channel to image
ImageEnView1.IEBitmap.Resize(1, 1, 1, 1, clWhite, 0); // Add an alpha border
ImageEnView1.Proc.FeatherAlphaEdges(10);