ImageEn, unit iexHelperFunctions

AddShapesToImageEnMView

AddShapesToImageEnMView

Declaration

// TImageEnMView overload
procedure AddShapesToImageEnMView(DestMView: TImageEnMView;
                                  Width, Height: Integer;
                                  BorderColor: TColor;
                                  BorderWidth: Integer;
                                  FillColor: TColor;
                                  ShapeSet: TIEShapeSet = iessAll;
                                  AlphaFill: Boolean = False;
                                  SourceBitmap: TIEBitmap = nil;
                                  CropAlpha: Boolean = False); overload;

// TIEMultiBitmap overload
procedure AddShapesToImageEnMView(DestMBitmap: TIEMultiBitmap;
                                  Width, Height: Integer;
                                  BorderColor: TColor;
                                  BorderWidth: Integer;
                                  FillColor: TColor;
                                  ShapeSet: TIEShapeSet = iessAll;
                                  AlphaFill: Boolean = False;
                                  SourceBitmap: TIEBitmap = nil;
                                  CropAlpha: Boolean = False); overload;

Description

Adds all TIEShapes to a TImageEnMView or TIEMultiBitmap.
Parameter Description
Dest The TImageEnMView or TIEMultiBitmap to add the images to (existing content is not cleared)
Width/Height Size to create the shapes
BorderColor, BorderWidth The color and size of the shape border (pass -1 to use a random color)
FillColor The color of the shape fill. Specify clNone for no fill, -1 to use a random color, or -2 to keep the existing content (by drawing the shape to the background as alpha)
ShapeSet Specify which shapes to add: All (iessAll), Unique Only (iessUniqueOnly) or only the most interesting shapes (iessBestSet)
AlphaFill Specify False to give the image a white background, or true for a transparent background
SourceBitmap Specify an image to use as the shape fill (The Color and AlphaFill properties will be ignored)
CropAlpha If true, the image will be cropped to the size of the shape
FillColor2 If SourceBitmap is specified a vertical gradient can be drawn behind the image (pass clNone for no gradient, or -1 to use a random color)

You can access the shape of an item by typecasting its tag as TIEShape, e.g.
// Get selected shape
shp := TIEShape( ImageEnMView1.ImageTag[ ImageEnMView1.SelectedImage ]);
ShowMessage( IEShapeToStr( shp ));

Note: You must add the iexHelperFunctions unit to your uses clause

Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Examples

// Display all shapes ImageEnMView1
AddShapesToImageEnMView( ImageEnMView1, 200, 200, clNone, 0, clRed );

// Display an interesting set of shapes filled by an image, the sort by shape name
ImageEnMView1.Clear();
srcBMP := TIEBitmap.Create( 'D:\image.jpg' );
AddShapesToImageEnMView( ImageEnMView1, 200, 200, clNone, 0, clNone, iessBestSet, True, srcBMP, True );
srBMP.Free();
ImageEnMView1.Sort( iesbBottomText );

See Also

IEDrawShapeToComboListBoxItem
IEShapeToStr

Compatibility Information

Before v15.0.0, a boolean parameter, UniqueOnly, was used instead of ShapeSet. Code that formerly passed False (default) should specify iessAll, whereas for true, specify iessUniqueOnly.