The TRect object is declared as follows:
TRect = OBJECT
A, B: TPoint;
FUNCTION Empty: Boolean;
FUNCTION Equals (R: TRect): Boolean;
FUNCTION Contains (P: TPoint): Boolean;
PROCEDURE Copy (R: TRect);
PROCEDURE Union (R: TRect);
PROCEDURE Intersect (R: TRect);
PROCEDURE Move (ADX, ADY: Sw_Integer);
PROCEDURE Grow (ADX, ADY: Sw_Integer);
PROCEDURE Assign (XA, YA, XB, YB: Sw_Integer);
END;
|
-
Declaration:
- Function TRect.Empty: Boolean;
-
Description:
- Empty returns True if the rectangle defined by the corner points A, B has zero or negative
surface.
-
Errors:
- None.
-
See also:
- TRect.Equals (556), TRect.Contains (556)
Listing: objectex/ex1.pp
-
Declaration:
- Function TRect.Equals (R: TRect): Boolean;
-
Description:
- Equals returns True if the rectangle has the same corner points A,B as the rectangle R,
and False otherwise.
-
Errors:
- None.
-
See also:
- Empty (555), Contains (556)
For an example, see TRect.Empty (555)
-
Declaration:
- Function TRect.Contains (P: TPoint): Boolean;
-
Description:
- Contains returns True if the point P is contained in the rectangle (including borders),
False otherwise.
-
Errors:
- None.
-
See also:
- Intersect (558), Equals (556)
-
Declaration:
- Procedure TRect.Copy (R: TRect);
-
Description:
- Assigns the rectangle R to the object. After the call to Copy, the rectangle R has been
copied to the object that invoked Copy.
-
Errors:
- None.
-
See also:
- Assign (560)
Listing: objectex/ex2.pp
-
Declaration:
- Procedure TRect.Union (R: TRect);
-
Description:
- Union enlarges the current rectangle so that it becomes the union of the current rectangle
with the rectangle R.
-
Errors:
- None.
-
See also:
- Intersect (558)
Listing: objectex/ex3.pp
-
Declaration:
- Procedure TRect.Intersect (R: TRect);
-
Description:
- Intersect makes the intersection of the current rectangle with R. If the intersection is
empty, then the rectangle is set to the empty rectangle at coordinate (0,0).
-
Errors:
- None.
-
See also:
- Union (557)
Listing: objectex/ex4.pp
-
Declaration:
- Procedure TRect.Move (ADX, ADY: Sw_Integer);
-
Description:
- Move moves the current rectangle along a vector with components (ADX,ADY). It adds ADX
to the X-coordinate of both corner points, and ADY to both end points.
-
Errors:
- None.
-
See also:
- Grow (560)
Listing: objectex/ex5.pp
-
Declaration:
- Procedure TRect.Grow (ADX, ADY: Sw_Integer);
-
Description:
- Grow expands the rectangle with an amount ADX in the X direction (both on the left and
right side of the rectangle, thus adding a length 2*ADX to the width of the rectangle), and
an amount ADY in the Y direction (both on the top and the bottom side of the rectangle,
adding a length 2*ADY to the height of the rectangle.
ADX and ADY can be negative. If the resulting rectangle is empty, it is set to the empty
rectangle at (0,0).
-
Errors:
- None.
-
See also:
- Move (559).
Listing: objectex/ex6.pp
-
Declaration:
- Procedure Trect.Assign (XA, YA, XB, YB: Sw_Integer);
-
Description:
- Assign sets the corner points of the rectangle to (XA,YA) and (Xb,Yb).
-
Errors:
- None.
-
See also:
- Copy (557)
For an example, see TRect.Copy (557).