ImageEn, unit iexBitmaps

TIEBitmap.FillWithShape

TIEBitmap.FillWithShape


Declaration

procedure FillWithShape(Shape: TIEShape;
                        iWidth, iHeight: Integer;
                        BorderColor: TColor;
                        BorderWidth: Integer;
                        FillColor: TColor;
                        AlphaFill: Boolean = False;
                        UsePreferedAR: Boolean = True;
                        Margins: Integer = 0;
                        Opacity: Double = 1.0);


Description

Draws a TIEShape to the bitmap.

Parameter Description
Width, Height Size to draw the shape (the bitmap will also be resized). If -1,-1 is specified the current size is used
BorderColor, BorderWidth The shape edge border. Specify clNone to skip the border, or -1 for a random color border
FillColor The shape color. Specify -1 to use a random color, or -2 to keep the existing content (by drawing the shape to the background as alpha)
AlphaFill If false, it gives the image a white background. If True, it uses an transparent background
UsePreferedAR Some shapes look better when output at their designed aspect ratio. Disable UsePreferedAR to fill the entire image
Margins Add spacing around the image
Opacity Specify how opaque to draw the image (1.0 is fully opaque, 0.0 is fully transparent)

Note:
If you use FillColor = -2 to keep the existing content, the following parameters are ignored: Width, Height, BorderColor, BorderWidth, AlphaFill
If attached to a TImageEnView, it will automatically call Update


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Fill bitmap with a balloon shape
ImageEnView1.IEBitmap.FillWithShape( iesBalloon, 200, 500, clBlack, 1, clMediumVioletRed, False );



// Create a shaped image by drawing to the alpha channel
ImageEnView1.IEBitmap.FillWithShape( iesRadiance, -1, -1, clNone, 0, -2, False, True );



// Create a shaped image by drawing an ImageEn shape to the alpha channel
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

ImageEnView1.IEBitmap.FillWithShape( iesHeart, -1, -1, clNone, 0, -2 { Keep Content } );

  


See Also

AdvancedDrawShape
IEDrawShape