- 4.37.2.116. -
Table of Contents
4. Standard Units
4.37. Graph - Graph unit
4.37.2. Graph Unit Procedures and Functions
4.37.2.116. SetViewPort procedure
4.37.2.116. SetViewPort procedure
Targets: MS-DOS, Win32
Graph Unit
Sets the current output viewport or window for graphics output
Declaration:
procedure SetViewPort(X1, Y1, X2, Y2: Longint; Clip: Boolean);
Remarks:
(X1, Y1) defines the upper left corner of the viewport,
and (X2, Y2) defines the lower right corner.
The upper left corner of a viewport is (0, 0).
The Boolean parameter Clip determines whether drawings
are clipped at the current viewport boundaries.
SetViewPort (0, 0, GetMaxX, GetMaxY, True)
always sets the viewport to the entire graphics screen.
If (X1 >=X2) or (Y1 >=Y2),
GraphResult returns grError,
and the current view settings will be unchanged.
The TMT Graph unit allows the assignment of viewport outside the screen!
All graphics commands (for example:
GetX,
OutText,
Line and so on) are viewport-relative.
If the Boolean parameter Clip is set to True
when a call to SetViewPort is made, all drawings
will be clipped to the current viewport.
Note that the current pointer is never clipped.
The following will not draw the whole line requested because
the line will be clipped to the current viewport:
SetViewPort(10, 10, 20, 20, ClipOn);
Line(0, 5, 15, 5);
The line would start at absolute coordinates (10,15)
and terminate at absolute coordinates (25, 15) if no clipping were performed.
But because clipping was performed, the actual line drawn would start at
absolute coordinates (10, 15) and terminate at coordinates (20, 15).
SetSVGAMode,
GraphDefaults, and
SetGraphMode
all reset the viewport to the entire graphics screen.
The current viewport settings are available by calling the procedure
GetViewSettings,
which accepts a parameter of
ViewPortType.
SetViewPort moves the current pointer to (0, 0).
- 4.37.2.116. -