ImageEn, unit ievect

TImageEnVect.CopyObjectTo

TImageEnVect.CopyObjectTo


Declaration

function CopyObjectTo(hobj: integer; Dest: TImageEnView; MoveObject: Boolean = False): integer;


Description

Assign the hobj object to another TImageEnVect or a TImageEnView.
If Dest is a TImageEnVect, the object is copied as a standard Vectorial object.
If Dest is a TImageEnView, the object is converted to a TIELayer.

Conversion is as follows:
Object Kind Converted To Notes
iekLINE TIELineLayer -
iekBOX TIEShapeLayer -
iekELLIPSE TIEShapeLayer -
iekARC TIEPolylineLayer -
iekBITMAP TIEImageLayer -
iekTEXT TIETextLayer -
iekRULER TIELineLayer Ruler notches will be lost. Text will be displayed below center
iekPOLYLINE TIEPolylineLayer -
iekANGLE TIEAngleLayer -
iekMEMO TIETextLayer Text formatting is lost
iekLINELABEL TIELineLayer Inward arrows are converted to outward arrows
If MoveObject is true, the object is removed from the TImageEnVect after copying.
Returns the handle of the created object (or index of the new layer).

Note: User data is not transferred unless MoveObject is true.


Example

// Move the content of a TImageEnVect (with Objects) to a TImageEnView (as layers)
var
  i, hobj: Integer;
begin
  // Clear existing content
  ImageEnView1.ClearAll();

  // Copy background image
  ImageEnView1.IEBitmap.Assign( ImageEnVect1.Layers[0].Bitmap );

  // Add objects as layers
  for i := ImageEnVect1.ObjectsCount - 1 downto 0 do
  begin
    hobj := ImageEnVect1.GetObjFromIndex(i);
    ImageEnVect1.CopyObjectTo( hobj, ImageEnView1, True );  // User data also transferred
  end;
end;


See Also

CopyAllLayersFrom
CopyAllObjectsTo
CopySelectedObjectsTo
LayersImport


Transition Information

If you are transitioning your code to TImageEnView Layers, instead of CopyObjectTo, use clone overload of: TImageEnView.LayersAdd

ImageEnView2.LayersAdd( ImageEnView1.CurrentLayer );