Area Brackets

Areas also are referred to as area brackets, because the functions that create and define the area always are "bracketed" by the two functions, GpiBeginArea and GpiEndArea. Only one area is defined between these two functions. However, within the area, there can be any number of adjacent, intersecting, or completely separate area primitives.

GpiBeginArea signals the start of a group of primitives that define the boundary of the area. The current position is not changed by GpiBeginArea, although it is updated by any drawing instructions that follow.

If you call GpiSetCurrentPosition or GpiMove within an area definition, the current figure is closed automatically, and a new figure is started at the current position by the next line or curve. A figure in the area, whose start and end points are not the same, is closed by drawing a straight line from the current position to the start position of the figure.

GpiEndArea signals the end of an area definition and tells the operating system to draw the area. If an application does not close a figure before calling GpiEndArea, the figure is closed automatically by drawing a straight line from the end point of the last line or curve to the start point of the current figure. The current position is always updated to the end point of the last line drawn.

The functional sequence to draw the area in the following figure could be:

#include <os2.h>
void fncAREA01(void){

#if 0

GpiBeginArea                /* Starts the area bracket          */

GpiSetCurrentPosition       /* Set the start point of the       */
                            /* outer hexagon.                   */
GpiPolyLine                 /* Draw the outer hexagon.          */
GpiSetCurrentPosition       /* Set the start point of the inner */
                            /*  hexagon.                        */
GpiPolyLine                 /* Draw the inner hexagon.          */

GpiEndArea                  /* End the area definition.         */

#endif

}

An area bracket contains the functions that define an area. Only one area can be defined between "bracket" functions.

Following the beginning of an area bracket, an application can define the shape and location of the area in world space by using the following line and arc functions:

If an application calls either GpiBox or GpiFullArc inside an area, it must use the DRO_OUTLINE option.

In addition to the drawing functions, an application also can use the following specification functions inside an area bracket: