We will now use the RECTANGLE statement to see how it is affected by different WINDOW and VIEWPORT values. There are several forms of the RECTANGLE statement. The simplest form specifies the desired width and height and draws only the border lines. For example:
GINIT
MOVE 10,20
RECTANGLE 10,10
END
This draws a small square near the origin. You can change the WINDOW to a smaller range to cause the square to be drawn larger. Add the following statement.
WINDOW 0,30,0,30
The VIEWPORT is still the entire screen, but the range of values mapped into the VIEWPORT is now smaller. The WINDOW values are (0,30,0,30) instead of the default (0,Ratio*100,0,100). This creates a larger box when the same RECTANGLE statement is used. Note that the square is now stretched onto the VIEWPORT. This is because the VIEWPORT is not square and the WINDOW was not adjusted to compensate. To get a square on the screen either the VIEWPORT or the WINDOW must be changed. The simplest way is to select a square VIEWPORT by adding the following statement.
VIEWPORT 0,100,0,100
Note that this displays the square again, but it is shifted to the left, since the right side of the screen is inaccessible with this VIEWPORT. Try experimenting with different WINDOW and VIEWPORT settings to understand how they interact with each other.