Difference between revisions of "TPADimensions"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer); </source> ==Availability== SCAR Divi 3.26 > Curren...")
 
 
Line 2: Line 2:
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
 
procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer);
 
procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer);
 +
</source>
 +
 +
===Source Code===
 +
<source lang="scar">
 +
procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer);
 +
var
 +
  Box: TBox;
 +
begin
 +
  Box := TPABounds(TPA);
 +
  Width := Box.X2 - Box.X1 + 1;
 +
  Height := Box.Y2 - Box.Y1 + 1;
 +
end;
 
</source>
 
</source>
  

Latest revision as of 10:07, 3 July 2011

Definition

procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer);

Source Code

procedure TPADimensions(const TPA: TPointArray; out Width, Height: Integer);
var
  Box: TBox;
begin
  Box := TPABounds(TPA);
  Width := Box.X2 - Box.X1 + 1;
  Height := Box.Y2 - Box.Y1 + 1;
end;

Availability

SCAR Divi 3.26 > Current

Description

Returns the dimensions of the area covered by a given TPointArray TPA in Width and Height.

Example

var
  w, h: Integer;

begin
  TPADimensions([Point(0, 0), Point(1, 2), Point(5, 4)], w, h);
  WriteLn(IntToStr(w) + 'x' + IntToStr(h));
end.

Output:

6x5

See Also