HTBasic Help
×
Menu
Index

VIEWPORT

Defines the area of the graphic device used for output.
 
 VIEWPORT left,right,bottom,top
 
Usage:
VIEWPORT Left,Right,Bottom,Top
VIEWPORT 0,75,10,30
Example: VIEWPORT.BAS
Description:
VIEWPORT selects the area of the screen (or device) to be used for graphics output and sets the soft-clip boundary limits. The coordinate system defined by WINDOW or SHOW will be mapped into this area. The left limit must be less than the right limit and the bottom limit must be less than the top limit. The default viewport is the entire surface.
By changing the VIEWPORT parameters, you change the proportions, size and position of the drawing surface. Graphic output is automatically scaled to fit this drawing surface. Changing the viewport does not affect any currently displayed graphics, only graphics that you subsequently generate.
Graphic Display Unit Parameters
VIEWPORT soft-clip boundary parameters are defined in GDUs (Graphic Display Units). GDUs are units that describe the physical bounds of the display area on the graphic output device. By definition, Graphic Display Units are 1/100 of the Y axis of a plotting device. A unit in the X direction and the Y direction is of the same length. The RATIO function returns the X to Y hard-clip limits ratio and can be used to determine the VIEWPORT soft-clip limits.
The VIEWPORT soft-clip limits should not exceed the hard-clip limits. By default the left limit is zero, the right limit is the X axis hard-clip limit, the bottom limit is zero and the top limit is the Y axis hard-clip limit.
Porting Issues
In HTBasic, GDUs are always 100 in the Y direction. In HP BASIC, if the ratio is less than 1, the X axis is 100 GDUs and the Y axis is (100*RATIO) GDUs long; if the ratio is greater than 1, the Y axis is 100 GDUs and the X axis is (100*RATIO) GDUs long.
See Also: