# RECTANGLE, RECTANGLE_W (W*S)

Graphics Functions: Draw a rectangle using the current graphics color, logical write mode, and line style.

## Module

USE IFQWIN

result = RECTANGLE (control, x1, y1, x2, y2)

result = RECTANGLE_W (control, wx1, wy1, wx2, wy2)

control | (Input) INTEGER(2). Fill flag. One of the following symbolic constants defined in `IFQWIN.F90`: $GFILLINTERIOR - Draws a solid figure using the current color and fill mask. $GBORDER - Draws the border of a rectangle using the current color and line style.
x1, y1 | (Input) INTEGER(2). Viewport coordinates for upper-left corner of rectangle.
x2, y2 | (Input) INTEGER(2). Viewport coordinates for lower-right corner of rectangle.
wx1, wy1 | (Input) REAL(8). Window coordinates for upper-left corner of rectangle.
wx2, wy2 | (Input) REAL(8). Window coordinates for lower-right corner of rectangle.

## Results

The result type is INTEGER(2). The result is nonzero if successful; otherwise, 0.

The RECTANGLE function uses the viewport-coordinate system. The viewport coordinates (x1, y1) and ( x2, y2) are the diagonally opposed corners of the rectangle.

The RECTANGLE_W function uses the window-coordinate system. The window coordinates (wx1, wy1) and (wx2, wy2) are the diagonally opposed corners of the rectangle.

SETCOLORRGB sets the current graphics color. SETFILLMASK sets the current fill mask. By default, filled graphic shapes are filled solid with the current color.

If you fill the rectangle using FLOODFILLRGB, the rectangle must be bordered by a solid line style. Line style is solid by default and can be changed with SETLINESTYLE.

### Note

The RECTANGLE routine described here is a QuickWin routine. If you are trying to use the Microsoft* Platform SDK version of the Rectangle routine by including the IFWIN module, you need to specify the routine name as MSFWIN$Rectangle.

## Example

This program draws the rectangle shown below.

     ! Build as a QuickWin or Standard Graphics App.
     USE IFQWIN
     INTEGER(2) dummy, x1, y1, x2, y2
     x1 = 80; y1 = 50
     x2 = 240; y2 = 150
     dummy = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
     END

Parent topic: Graphics Library Routines

## See Also

SETFILLMASK
GRSTATUS
LINETO
POLYGON
FLOODFILLRGB
SETLINESTYLE
SETCOLOR
SETWRITEMODE