How to Get Windows NT PolyDraw() Functionality in Windows 95

Last reviewed: September 29, 1995
Article ID: Q135059
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows 95 version 4.0
    

SUMMARY

This article shows by example how to get the functionality provided by the Win32 function PolyDraw() in Windows 95.

MORE INFORMATION

The Windows NT PolyDraw() function draws a set of line segments and Bezier curves. PolyDraw() can be used in place of consecutive calls to the MoveToEx(), LineTo(), and PolyBezierTo() functions to draw disjoint figures. The lines and curves are drawn using the current pen, and figures are not filled. If there is an active path started by calling BeginPath(), then PolyDraw() adds to the path. The points contained in the lppt array and in the lpbTypes array indicate whether each point is part of a MoveToEx(), LineTo(), or PolyBezierTo() operation. It is also possible to close figures.

Code Sample

The following function enables you to get the functionality of the Windows NT PolyDraw() function in Windows 95:

/**********************************************************************
 *                                                                    *
 * FUNCTION:  PolyDraw95(HDC, LPPOINT, LPBYTE, int)                   *
 *                                                                    *
 * PURPOSE:   Draws the points returned from a call to GetPath()      *
 *            to an HDC                                               *
 *                                                                    *
 * NOTES:     This function is similar to the Windows NT PolyDraw     *
 *            function, which draws a set of line segments and Bezier *
 *            curves. Because PolyDraw is not supported in Windows 95 *
 *            this PolyDraw95 function is used instead.               *
 *                                                                    *
 *********************************************************************/
BOOL PolyDraw95(HDC  hdc,              // handle of a device context
                CONST LPPOINT lppt,      // array of points
                CONST LPBYTE lpbTypes, // line and curve identifiers
                int  cCount)             // count of points
{
  int i;

  for (i=0; i<cCount; i++)
    switch (lpbTypes[i]) {
      case PT_MOVETO :
         MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL);
         break;

      case PT_LINETO | PT_CLOSEFIGURE:
      case PT_LINETO :
         LineTo(hdc, lppt[i].x, lppt[i].y);
         break;

      case PT_BEZIERTO | PT_CLOSEFIGURE:
      case PT_BEZIERTO :
        PolyBezierTo(hdc, &lppt[i], 3);
       i+=2;
         break;
    }

   return TRUE;
}


Additional reference words: 95 4.00 PolyDraw Draw Poly Stones Win95 GDI
KBCategory: kbgraphic kbcode
KBSubcategory: GdiMisc


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 29, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.