| ImageEn, unit imageenproc |
|
TImageEnProc.CutToClipboard
Declaration
function CutToClipboard(Source: TIECopyPasteType = iecpAuto; CutAlpha: Boolean = false; DeleteOnly: Boolean = false): Boolean;
Description
Copies the selected region, image or layer to the clipboard and then removes it.
Possible values for
Source:
| Item | Effect |
| iecpAuto | ImageEn automatically detects what to cut. If there is a valid selection, it is cut. If not, and a layer (other than the background) is selected, it is cut. Otherwise nothing is cut |
| iecpFullImage | If the image is valid, it is copied to the clipboard, then cleared. Otherwise, it fails |
| iecpSelection | If there is a selection in the associated TImageEnView, it is copied to the clipboard then cut from the image. If there is no selection, it fails |
| iecpLayer | If there is a layer selected in the associated TImageEnView, which is not the background layer, it is copied to the clipboard (as an image and a layer) and then removed from the image |
If
CutAlpha is true, the selected area is made transparent (has no effect unless there is a selection).
If
DeleteOnly is true, the selected region, image or layer is deleted (without being copied to the clipboard). For iecpSelection, this is the same as calling
ClearSel.
Returns true if successful.
Note:
◼By default,
transparency is NOT supported, when pasting images to other applications. To support transparency, configure
ClipboardCopyFormats
◼The main reason for unexpected failures are very large images that exceed the available memory
◼Only iecpFullImage is relevant if the
TImageEnProc is attached to a
TIEBitmap,
TImageEnMView or
TImageEnFolderMView (iecpAuto will have the same effect as iecpFullImage. iecpSelection and iecpLayer will always fail)
◼Cutting of layers to the clipboard will be prevented if loPreventLayerDelete is specified for
LayerOptions (layer will be copied instead)
◼This method supports
PdfViewer if Source = iecpAuto
Demo
| Demos\ImageEditing\CompleteEditor\PhotoEn.dpr |
Examples
// General cut to clipboard method
ImageEnView1.Proc.CutToClipboard();
// Cutting of selection to clipboard (leaving cut region as transparent)
ImageEnView1.Proc.CutToClipboard( iecpSelection, True );
// Cutting of selected layer to clipboard
ImageEnView1.Proc.CutToClipboard( iecpLayer );
// Cutting the whole image to the clipboard
ImageEnView1.Proc.CutToClipboard( iecpFullImage );
// Cut the selected image in a TImageEnMView to the clipboard (Note: bitmap is cleared, not removed)
if IEMView1.SelectedImage >= 0 then
IEMView1.Proc.CutToClipboard( iecpFullImage );
// Select and cut from the image, leaving 1 pixel border behind
ImageEnView1.IO.LoadFromFile( 'D:\png_10x20.png' );
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.Select( 1, 1, ImageEnView1.IEBitmap.Width - 1, ImageEnView1.IEBitmap.Height - 1 );
ImageEnView1.Proc.CutToClipboard();
See Also
◼CanCutToClipboard
◼CanCopyToClipboard
◼CopyToClipboard
◼CanPasteFromClipboard
◼PasteFromClipboard
◼PointPasteFromClip
◼ClipboardCopyFormats