ImageEn, unit iemview

TImageEnMView.ReleaseBitmap

TImageEnMView.ReleaseBitmap


Declaration

procedure ReleaseBitmap(idx: Integer; saveChanges: Boolean = true);


Description

Releases the bitmap created with GetBitmap or GetTIEBitmap method.

Parameter Description
idx The image index to release
saveChanges If true (default) the changed bitmap will be updated in the control (i.e. set to False if you didn't change the bitmap, or don't need to save your changes)

Note: If saveChanges = true, you must call Update to display the changes


Examples

// Save the fifth image to file
bmp := ImageEnMView1.GetTIEBitmap(4); // Note: bmp must be TIEBitmap type
bmp.SaveToFile('D:\alfa.png');
ImageEnMView1.ReleaseBitmap(4, False);


// Display the fifth image in a TImageEnView
bmp := ImageEnMView1.GetTIEBitmap(4); // Note: bmp must be TIEBitmap type
ImageEnView1.Assign( bmp );
ImageEnMView1.ReleaseBitmap(4, False);

// Update the fifth image in the TImageEnView with the current content of a TImageEnView (e.g. after user has edited it)
bmp := ImageEnMView1.GetTIEBitmap(4); // Note: bmp must be TIEBitmap type
bmp.Assign( ImageEnView1.IEBitmap );
ImageEnMView1.ReleaseBitmap(4, True);
ImageEnMView1.Update();


// Add copyright text to all images
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
  bmp := ImageEnMView1.GetTIEBitmap( i );
  with TImageEnProc.CreateFromBitmap( bmp ) do
  begin
    ConvertTo24Bit();
    TextOut(Align_Text_Horz_Center, Align_Text_Near_Bottom, 'Copyright Skynet', 'Arial', 25, clRed, [fsBold], 0, True);
    Free;
  end;

  ImageEnMView1.ReleaseBitmap( i, True );
end;
ImageEnMView1.Update();


// Rotate selected images right (90° clockwise)
for i := 0 to ImageEnMView1.ImageCount - 1 do
  if ImageEnMView1.IsSelected( i ) then
  begin
    bmp := ImageEnMView1.GetTIEBitmap( i );
    bmp.Rotate( 270 );
    ImageEnMView1.ReleaseBitmap( i, True );
  end;
ImageEnMView1.Update();