# PIE, PIE_W (W*S)

Graphics Functions: Draw a pie-shaped wedge in the current graphics color.

## Module

USE IFQWIN

result = PIE (i,x1,y1,x2,y2,x3,y3,x4,y4)

result = PIE_W (i, wx1, wy1, wx2, wy2, wx3, y3,wx4, wy4)

i | (Input) INTEGER(2). Fill flag. One of the following symbolic constants defined in `IFQWIN.F90`: $GFILLINTERIOR - Fills the figure using the current color and fill mask. $GBORDER - Does not fill the figure.
x1, y1 | (Input) INTEGER(2). Viewport coordinates for upper-left corner of bounding rectangle.
x2, y2 | (Input) INTEGER(2). Viewport coordinates for lower-right corner of bounding rectangle.
x3, y3 | (Input) INTEGER(2). Viewport coordinates of start vector.
x4, y4 | (Input) INTEGER(2). Viewport coordinates of end vector.
wx1, wy1 | (Input) REAL(8). Window coordinates for upper-left corner of bounding rectangle.
wx2, wy2 | (Input) REAL(8). Window coordinates for lower-right corner of bounding rectangle.
wx3, wy3 | (Input) REAL(8). Window coordinates of start vector.
wx4, wy4 | (Input) REAL(8). Window coordinates of end vector.

## Results

The result type is INTEGER(2). The result is nonzero if successful; otherwise, 0. If the pie is clipped or partially out of bounds, the pie is considered successfully drawn and the return is 1. If the pie is drawn completely out of bounds, the return is 0.

The border of the pie wedge is drawn in the current color set by SETCOLORRGB.

The PIE function uses the viewport-coordinate system. The center of the arc is the center of the bounding rectangle, which is specified by the viewport-coordinate points (x1, y1) and ( x2, y2). The arc starts where it intersects an imaginary line extending from the center of the arc through ( x3, y3). It is drawn counterclockwise about the center of the arc, ending where it intersects an imaginary line extending from the center of the arc through (x4, y4).

The PIE_W function uses the window-coordinate system. The center of the arc is the center of the bounding rectangle specified by the window-coordinate points (wx1, wy1) and ( wx2, wy2). The arc starts where it intersects an imaginary line extending from the center of the arc through ( wx3, wy3). It is drawn counterclockwise about the center of the arc, ending where it intersects an imaginary line extending from the center of the arc through ( wx4, wy4).

The fill flag option $GFILLINTERIOR is equivalent to a subsequent call to FLOODFILLRGB using the center of the pie as the starting point and the current graphics color (set by SETCOLORRGB) as the fill color. If you want a fill color different from the boundary color, you cannot use the $GFILLINTERIOR option. Instead, after you have drawn the pie wedge, change the current color with SETCOLORRGB and then call FLOODFILLRGB. You must supply FLOODFILLRGB with an interior point in the figure you want to fill. You can get this point for the last drawn pie or arc by calling GETARCINFO.

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

### Note

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

## Example

     ! build as Graphics App.
     USE IFQWIN
     INTEGER(2) status, dummy
     INTEGER(2) x1, y1, x2, y2, x3, y3, x4, y4
     x1 = 80; y1 = 50
     x2 = 180; y2 = 150
     x3 = 110; y3 = 80
     x4 = 90; y4 = 180

     status = SETCOLOR(INT2(4))
     dummy = PIE( $GFILLINTERIOR, x1, y1, x2, y2, &
                                  x3, y3, x4, y4)
     END

This figure shows the coordinates used to define PIE and PIE_W:

Parent topic: Graphics Library Routines

## See Also

SETCOLORRGB
SETFILLMASK
SETLINESTYLE
FLOODFILLRGB
GETARCINFO
ARC
ELLIPSE
GRSTATUS
LINETO
POLYGON
RECTANGLE