[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]

*GL3.2 for AIX: Graphics Library (GL) Technical Reference*

## rect Subroutine

### Purpose

Draws an unfilled rectangle.

### Libraries

Graphics Library

C (**libgl.a**)

FORTRAN (**libfgl.a**)

### C Syntax

**void rect**
**(Coord ***x1***, Coord** *y1***,**
**Coord** *x2***, Coord** *y2***)**

**void recti**
**(Icoord ***x1***, Icoord** *y1***,**
**Icoord** *x2***, Icoord** *y2***)**

**void rects**
**(Scoord ***x1***, Scoord** *y1***,**
**Scoord** *x2***, Scoord** *y2***)**

### FORTRAN Syntax

**SUBROUTINE RECT(***x1***,*** y1***,*** x2***,*** y2***)**
**REAL ***x1***, ***y1***, ***x2***, ***y2*

**SUBROUTINE RECTI(***x1***,*** y1***,*** x2***,*** y2***)**
**INTEGER*4 ***x1***, ***y1***, ***x2***, ***y2*

**SUBROUTINE RECTS(***x1***,*** y1***,*** x2***,*** y2***)**
**INTEGER*2 ***x1***, ***y1***,** *x2***, ***y2*

**Note: **For FORTRAN users, the INTEGER*2 version, the **RECTS** subroutine, should not be called with integer constant parameters. For example, 2 is an integer constant; JJ is an integer variable. The XL FORTRAN compiler, invoked by the **xlf** command, stores all integer constants as long integers (INTEGER*4), not as short integers (INTEGER*2). Invoking the short version of this subroutine with an integer constant will result in unexpected behavior.

### Description

The **rect** subroutine draws a rectangle using the current line attributes:
linestyle,
linewidth,
color, and
writemask. The sides of the rectangle are parallel to the *x* and *y* axes. Since a rectangle is a 2-D shape, the **rect** subroutine takes only 2-D arguments, and sets the *z* coordinate to zero. The current graphics position is set to (*x1, y1*) after the rectangle is drawn.

The syntax for each of the subroutine forms is the same except for the first argument. They differ only in that **rect** expects real coordinates, **recti** expects integer coordinates, and **rects** expects short integer coordinates.

### Parameters

*x1* |
Specifies the *x* coordinate of one corner of the rectangle. |

*y1* |
Specifies the *y* coordinate of one corner of the rectangle. |

*x2* |
Specifies the *x* coordinate of the opposite corner of the rectangle. |

*y2* |
Specifies the *y* coordinate of the opposite corner of the rectangle. |

### Example

The example C language program **tpbig.c** uses the **recti** subroutine to draw the outline of a rectangle in green.

### Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.

### Files

**/usr/include/gl/gl.h** |
Contains C language constant and variable type definitions for GL. |

**/usr/include/gl/fgl.h** |
Contains FORTRAN constant and variable type definitions for GL. |

### Related Information

Drawing a polygon with the **poly** subroutine.

Drawing a filled rectangle with the **rectf** subroutine.

AIX Graphics Library Overview, Setting Drawing Attributes, Drawing Rectangles, Circles, Arcs, and Polygons.

[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]