VIEWPORTselects the area of the screen (or device) to be used for graphics output and sets the soft-clip boundary limits. The coordinate system defined byWINDOWorSHOWwill 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 theVIEWPORTparameters, 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
VIEWPORTsoft-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. TheRATIOfunction returns the X to Y hard-clip limits ratio and can be used to determine theVIEWPORTsoft-clip limits.
TheVIEWPORTsoft-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.