ImageEn, unit iemview

TImageEnMView.AppendImage

TImageEnMView.AppendImage


Declaration

// General Append (blank image)
procedure AppendImage(); overload;

// General Append (blank image of specific size and color depth)
procedure AppendImage(Width, Height: integer; PixelFormat: TIEPixelFormat = ie24RGB); overload;

// Append from TIEBitmap source
procedure AppendImage(Bitmap: TIEBitmap); overload;

// Append from TBitmap source
procedure AppendImage(Bitmap: TBitmap); overload;

// Load image from file overload
procedure AppendImage(const FileName: string); overload;

// Load frame from video overload
procedure AppendImage(const FileName: string; FrameIndex: Integer); overload;

// Advanced loading overload
procedure AppendImage(const FileName: String;
                      LoadOnDemand: boolean;
                      DefaultTopText: TIEImageEnMViewDefaultText = iedtNone;
                      DefaultInfoText: TIEImageEnMViewDefaultText = iedtNone;
                      DefaultBottomText: TIEImageEnMViewDefaultText = iedtFilename;
                      bSelectIt : Boolean = true); overload;

// Stream loading overload
procedure AppendImage(Stream: TStream; FileFormat: TIOFileType = ioUnknown);


Description

Adds a new image at last position in the list and returns the new image position.

Note:
First overload of AppendImage() does NOT create the bitmap. You can initialize an empty bitmap with AppendImage( 0,0,ie24RGB )
With TIEBitmap overload, the source bitmap may be modified
The added image will become selected. To prevent selection add iemoDontSelectOnAdd to MultiSelectionOptions

The parameters for the final overload are as follows:
Parameter Description
Filename The full path to a file or folder available on the system, or an HTTP or FTP link to a remote file. You can load a particular frame from a multi-frame image or video by delimiting it with IEM_Path_Index_Delimiter
LoadOnDemand If True, the image will not be loaded from disk until it is displayed (i.e. when it is scrolled into view)
DefaultTopText Specify the text that is applied to ImageTopText
DefaultInfoText Specify the text that is applied to ImageInfoText
DefaultBottomText Specify the text that is applied to ImageBottomText (defaults to the filename)
bSelectIt If True, the new image will be selected in the control


Examples

ImageEnView1.IO.LoadFromFile( 'C:\MyImage.tif' );
idx := ImageEnMView1.AppendImage();
ImageEnMView1.SetImage( idx, ImageEnView1.IEBitmap );

// Which is the same as...
ImageEnMView1.AppendImage( 'C:\MyImage.tif' );

// Load the fifth image of MyImage.tif
ImageEnMView1.AppendImage( 'C:\MyImage.tif', 4 );

// Append 256 x 256 bitmap
ImageEnMView1.AppendImage( 256, 256, ie24RGB );

// Append a file from the web
ImageEnMView1.AppendImage( 'http://www.imageen.com/graphics/imageen.gif' );

// Show the first ten frames of a video file
for i := 0 to 9 do
  ImageEnMView1.AppendImage( 'D:\Temp\Cement.avi', i );

// Append an image from a stream (letting ImageEn automatically detect the format)
ImageEnMView1.AppendImage( MemStream, ioUnknown );

// Append all pages of a TIFF to the current content (will load on demand)
pageCount := EnumTIFFIm( sFileName );
for i := 0 to pageCount - 1 do
  ImageEnMView1.AppendImage( sFileName, i );

// Fill the grid with the content of a TFileListBox
procedure TForm1.FileListBox1Change(Sender: TObject);
var
  i: Integer;
begin
  ImageEnFolderMView1.Clear();
  for i := 0 to FileListBox1.Items.Count - 1 do
    ImageEnFolderMView1.AppendImage( IEAddBackSlash(FileListBox1.Directory) + FileListBox1.Items[i], true );
end;

// Append a JPEG that is Base64 encoded
ms := TMemoryStream.Create();
try
  IEDecode64( SourceStream, ms);
  ms.Position := 0;
  ImageEnMView1.AppendImage( ms, ioJPEG );
finally
  ms.Free();
end;

// Create an animated GIF file from ten source images
ImageEnMView1.Clear;
for i := 0 to 9 do
begin
  ImageEnMView1.AppendImage( format( 'D:\Source\Frame %d.bmp', [i] ));
  ImageEnMView1.MIO.Params[i].GIF_DelayTime := 10; // Display each frame for 1/10th of a second
end;
ImageEnMView1.MIO.SaveToFileGIF( 'D:\Animated.gif' );


See Also

InsertImage
InsertImageEx
FillFromList
FillFromDirectory
FillFromZip