Copies the current selection to the specified bitmap. The alpha channel is also copied.
If FillBackground is enabled, then non-selected areas of the copied rectangle of the image will be filled with the background color. Otherwise, it is transferred as alpha.
Note: To copy all or part of the image to other classes, such as TImage or TPicture, use AssignSelTo
// If an area of the image is selected, print the selection, otherwise print the whole image procedure TForm1.PrintImageClick(Sender: TObject); var bmp: TIEBitmap; IO: TImageEnIO; begin if ImageEnView1.Selected = False then ImageEnView1.IO.DoPrintPreviewDialog( iedtDialog, '' ) else begin bmp := TIEBitmap.Create; IO := TImageEnIO.CreateFromBitmap( bmp ); try ImageEnView1.CopySelectionToBitmap( bmp ); IO.DoPrintPreviewDialog( iedtDialog, '' ); finally IO.Free(); bmp.Free(); end; end; end;
// Create image layer from current selection // Note: This is only an example. An easier method is TImageEnView.LayersCreateFromSelection if ImageEnView1.Selected then begin bmp := TIEBitmap.create(); ImageEnView1.CopySelectionToBitmap( bmp, False ); ImageEnView1.LayersAdd( bmp ); ImageEnView1.CurrentLayer.PosX := ImageEnView1.SelectedRect.x; ImageEnView1.CurrentLayer.PosY := ImageEnView1.SelectedRect.y; ImageEnView1.Deselect; ImageEnView1.Update(); bmp.Free(); end;
// Select a pentagonal area of the image and save it to PNG (with transparent background) const PENT_X1 = 0.21; PENT_Y1 = 0.41; PENT_X2 = 0.32; PENT_Y2 = 0.74; PENT_X3 = 0.68; PENT_Y3 = 0.74; PENT_X4 = 0.79; PENT_Y4 = 0.41; PENT_X5 = 0.50; PENT_Y5 = 0.20; var bmp: TIEBitmap; bw, bh: Integer; begin ImageEnView1.SelectionBase := iesbBitmap;