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

ID: Q135059

4.00 WINDOWS kbgraphic kbcode
The information in this article applies to:


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 disjointfigures. 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;
   }

   } 

Additional query words: 4.00 PolyDraw Draw Poly Stones Win95 GDI


Keywords          : kbSDKWin32 kbWinOS95 kbDSupport 
Version           : winnt:
Platform          : winnt 
Issue type        : kbhowto 

Last Reviewed: June 28, 1999