[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]

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

## rectf Subroutine

### Purpose

Draws a filled rectangle.

### Libraries

Graphics Library

C (**libgl.a**)

FORTRAN (**libfgl.a**)

### C Syntax

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

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

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

### FORTRAN Syntax

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

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

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

**Note: **For FORTRAN users, the INTEGER*2 version, the **RECTFS** 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 **rectf **subroutine produces a filled rectangular region, using the current area attributes:
pattern,
color, and
writemask. The sides of the rectangle are parallel to the *x* and *y* axes of the object coordinate system.

Since a rectangle is a 2-D shape, the **rectf** subroutine takes only 2-D arguments and sets the coordinate to zero. The current graphics position is set to (*x1, y1*) after the region is drawn. Backfacing polygon removal works correctly if (*x1, y1*) specifies the lower left corner and (*x2, y2*) the upper right corner of the rectangle.

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

### Parameters

*x1* |
Specifies the *x* coordinate of one corner of the rectangle that is to be drawn. |

*y1* |
Specifies the *y* coordinate of one corner of the rectangle that is to be drawn. |

*x2* |
Specifies the *x* coordinate of the opposite corner of the rectangle that is to be drawn. |

*y2* |
Specifies the *y* coordinate of the opposite corner of the rectangle that is to be drawn. |

### Example

The example C language program **tpbig.c** uses the **rectfi** subroutine to draw a filled, red rectangle.

### 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 filled polygon with the **polf** subroutine.

Drawing a rectangle with the **rect** subroutine.

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

[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]