ImageEn, unit iexBitmaps

TIEMultiBitmap.OnGetVirtual

TIEMultiBitmap.OnGetVirtual


Declaration

property OnGetVirtual: TIEMBitmapGetVirtualEvent;


Description

Occurs whenever content is needed if in virtual mode.


Demo

Demo  Demos\Multi\VirtualMultiBitmap\VirtualMultiBitmap.dpr


Example

// Create a 100-frame TIFF file, where each frame shows its index
mbmp := TIEMultiBitmap.Create();
mbmp.OnGetVirtual := GetVirtualImage;
mbmp.VirtualCount := 100;
mbmp.IsVirtual    := True;
mbmp.Write( 'D:\NumberedTIFF.tiff' );
mbmp.Free;

// Event to supply each virtual frame
procedure TMainForm.GetVirtualImage(Sender: TObject; idx: integer; var Width, Height: Integer; Image: TIEBitmap; Params: TIOParams);
const
  Image_Width  = 800;
  Image_Height = 600;
var
  proc: TImageEnProc;
begin
  // Seeking bitmap?
  if Image <> nil then
  begin
    // Create our bitmap for image idx

    // Allocate size and fill with background color
    Image.Allocate( Image_Width, Image_Height, clYellow );

    // Draw text (image number)
    proc := TImageEnProc.CreateFromBitmap( Image );
    proc.TextOut( Align_Text_Horz_Center, Align_Text_Vert_Center, IntToStr( idx ), 'Arial', 128, clRed, [fsBold]);
    proc.Free;
  end
  else
  // Seek IO Parameters?
  if Params <> nil then
  begin
    // Specify the image properties of image idx
    Params.TIFF_Compression := ioTIFF_JPEG;
    Params.TIFF_JPEGQuality := 85;
  end
  else
  // Image Dimensions
  if Params <> nil then
  begin
    // Specify the size of image idx
    Width  := Image_Width;
    Height := Image_Height;
  end;
end;


// Displaying a virtual multi-bitmap in a TImageEnMView
TIEMultiBitmap( ImageEnMView1.IEMBitmap ).OnGetVirtual := GetVirtualImage;
TIEMultiBitmap( ImageEnMView1.IEMBitmap ).VirtualCount := 10000;
TIEMultiBitmap( ImageEnMView1.IEMBitmap ).IsVirtual    := True;


See Also

 IsVirtual
 VirtualCount