Sign in Join
FPDoc Onlineexperiment

CalculateLeftTopWidthHeight procedure

In unit GraphMath

Calculates the values for the output variables in Left, Top, Width, and Height.

Declaration

pascal
procedure CalculateLeftTopWidthHeight(X1: Integer; Y1: Integer; 
 X2: Integer; Y2: Integer; 
 out Left: Integer; 
 out Top: Integer; 
 out Width: Integer; 
 out Height: Integer)

Arguments

X1

Horizontal coordinate examined in the routine.

Y1

Vertical coordinate examined in the routine.

X2

Horizontal coordinate examined in the routine.

Y2

Vertical coordinate examined in the routine.

Left

Returns the left coordinate for the specified values.

Top

Returns the top coordinate for the specified values.

Width

Returns the width for the specified horizontal coordinates.

Height

Returns the height for the specified vertical coordinates.

Description

CalculateLeftTopWidthHeight checks values in the X1, X2, Y1, and Y2 arguments and sets the values for the Left, Top, Width, and Height output parameters accordingly.

Left
Set to the smaller of the two values in X1 and X2.
Width
Set to the difference between the X1 and X2 values. The value will be a positive integer value or zero (0).
Top
Set to the smaller of the two values in Y1 and Y2.
Height
Set to the difference between Y1 and Y2. The value will be a positive integer value or zero (0).

Used in the implementation of the Rectangle and Ellipse routines for the GTK widgetset.

Added in LazUtils version 3.0.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.