DrawPoly Function

Microchip Graphics Library

Microchip Graphics Library
DrawPoly Function
C
WORD DrawPoly(
    SHORT numPoints, 
    SHORT * polyPoints
);
Overview

This function draws a polygon with the current line type using the given number of points. The polygon points (polyPoints) are stored in an array arranged in the following order:

         SHORT polyPoints[size] = {x0, y0, x1, y1, x2, y2 … xn, yn};
         Where n = # of polygon sides
               size = numPoints * 2

DrawPoly() draws any shape defined by the polyPoints. The function will just draw the lines connecting all the x,y points enumerated by polyPoints[].

Input Parameters
Input Parameters 
Description 
SHORT numPoints 
Defines the number of x,y points in the polygon. 
SHORT * polyPoints 
Pointer to the array of polygon points. The array defines the x,y points of the polygon. The sequence should be x0, y0, x1, y1, x2, y2, ... xn, yn where n is the # of polygon sides. 
Returns

For NON-Blocking configuration:

  • Returns 0 when device is busy and the shape is not yet completely drawn.
  • Returns 1 when the shape is completely drawn.
For Blocking configuration:
  • Always return 1.

Side Effects

none

Example
    SHORT OpenShapeXYPoints[6] = {10, 10, 20, 10, 20, 20};
    SHORT ClosedShapeXYPoints[8] = {10, 10, 20, 10, 20, 20, 10, 10};

    SetColor(WHITE);                         // set color to WHITE
    SetLineType(SOLID_LINE);                 // set line to solid line
    SetLineThickness(THICK_LINE);            // set line to thick line
    DrawPoly(6, OpenShapeXYPoints);          // draw the open shape  
    DrawPoly(8, ClosedShapeXYPoints);        // draw the closed shape  
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved