CopyTPA

From SCAR Divi Manual
Revision as of 19:15, 20 October 2011 by Freddy (talk | contribs)
Jump to: navigation, search

Definition

function CopyTPA(const TPA: TPointArray): TPointArray;

Availability

SCAR Divi 3.28 > Current

Description

Creates a new TPointArray with a copy of every element in the given array TPA. An extended function with additional functionality is available as CopyTPAEx.

Example

var
  TPA, TPA2: TPointArray;

begin
  TPA := [Point(5, 6), Point(0, 0), Point(1, 1)];
  TPA2 := TPA;
  TPASort(TPA2);
  WriteLn('TPA passed by reference to TPA2:');
  WriteLn('TPA: ' + TPAToStr(TPA));
  WriteLn('TPA2: ' + TPAToStr(TPA2));

  TPA := [Point(5, 6), Point(0, 0), Point(1, 1)];
  TPA2 := CopyTPA(TPA);
  TPASort(TPA2);
  WriteLn('TPA passed by value to TPA2:');
  WriteLn('TPA: ' + TPAToStr(TPA));
  WriteLn('TPA2: ' + TPAToStr(TPA2));
end.

Output:

TPA passed by reference to TPA2:
TPA: (0,0);(1,1);(5,6)
TPA2: (0,0);(1,1);(5,6)
TPA passed by value to TPA2:
TPA: (5,6);(0,0);(1,1)
TPA2: (0,0);(1,1);(5,6)

See Also