Intel® Fortran Compiler 18.0 Developer Guide and Reference

POLYGON, POLYGON_W (W*S)

Graphics Functions: Draw a polygon using the current graphics color, logical write mode, and line style.

Module

USE IFQWIN

result = POLYGON (control,lppoints,cpoints)

result = POLYGON_W (control,lppoints,cpoints)

control

(Input) INTEGER(2). Fill flag. One of the following symbolic constants defined in IFQWIN.F90:

  • $GFILLINTERIOR - Draws a solid polygon using the current color and fill mask.

  • $GBORDER - Draws the border of a polygon using the current color and line style.

lppoints

(Input) Derived type xycoord. Array of derived types defining the polygon vertices in viewport coordinates. The derived type xycoord is defined in IFQWIN.F90 as follows:

 TYPE xycoord
   INTEGER(2) xcoord
   INTEGER(2) ycoord
 END TYPE xycoord

cpoints

(Input) INTEGER(2). Number of polygon vertices.

Results

The result type is INTEGER(2). The result is nonzero if anything is drawn; otherwise, 0.

The border of the polygon is drawn in the current graphics color, logical write mode, and line style, set with SETCOLORRGB, SETWRITEMODE, and SETLINESTYLE, respectively. The POLYGON routine uses the viewport-coordinate system (expressed in xycoord derived types), and the POLYGON_W routine uses real-valued window coordinates (expressed in xycoord types).

The argument lppoints is an array whose elements are xycoord derived types. Each element specifies one of the polygon's vertices. The argument cpoints is the number of elements (the number of vertices) in the lppoints array.

Note that POLYGON draws between the vertices in their order in the array. Therefore, when drawing outlines, skeletal figures, or any other figure that is not filled, you need to be careful about the order of the vertices. If you don't want lines between some vertices, you may need to repeat vertices to make the drawing backtrack and go to another vertex to avoid drawing across your figure. Also, POLYGON draws a line from the last specified vertex back to the first vertex.

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

NOTE

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

Example

 ! Build as a Graphics App.

 ! Draw a skeletal box
     USE IFQWIN
     INTEGER(2) status
     TYPE (xycoord) poly(12)

 ! Set up box vertices in order they will be drawn, &
 !    repeating some to avoid unwanted lines across box

     poly(1)%xcoord = 50
     poly(1)%ycoord = 80
     poly(2)%xcoord = 85
     poly(2)%ycoord = 35
     poly(3)%xcoord = 185
     poly(3)%ycoord = 35
     poly(4)%xcoord = 150
     poly(4)%ycoord = 80
     poly(5)%xcoord = 50
     poly(5)%ycoord = 80
     poly(6)%xcoord = 50
     poly(6)%ycoord = 180
     poly(7)%xcoord = 150
     poly(7)%ycoord = 180
     poly(8)%xcoord = 185
     poly(8)%ycoord = 135
     poly(9)%xcoord = 185
     poly(9)%ycoord = 35
     poly(10)%xcoord = 150
     poly(10)%ycoord = 80
     poly(11)%xcoord = 150
     poly(11)%ycoord = 180
     poly(12)%xcoord = 150
     poly(12)%ycoord = 80

     status = SETCOLORRGB(Z'0000FF')
     status = POLYGON($GBORDER, poly, INT2(12))
     END

See Also