RECTANGLE, RECTANGLE_W

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

Module: USE DFLIB

Syntax

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 DFLIB.F90 in the \DF98\INCLUDE subdirectory):



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 is of type 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 Win32 SDK version of the Rectangle routine by including the DFWIN module, you need to specify the routine name as MSFWIN$Rectangle. For more information, see Special Naming Convention for Certain QuickWin and Win32 Graphics Routines in the Programmer's Guide.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also: SETFILLMASK, GRSTATUS, LINETO, POLYGON, FLOODFILLRGB, SETLINESTYLE, SETCOLOR, SETWRITEMODE

Example

This program draws the rectangle shown below.

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

Figure: Output of Program RECTNGL.FOR