Share via


GraphicsPathIterator.NextMarker(GraphicsPath*) method

Applies to: desktop apps only

The GraphicsPathIterator::NextMarker method gets the next marker-delimited section of this iterator's associated path.

Syntax

INT NextMarker(
  [out]  GraphicsPath *path
);

Parameters

  • path [out]
    Type: GraphicsPath*

    Pointer to a GraphicsPath object. This method sets the data points of this GraphicsPath object to match the data points of the retrieved section.

Return value

Type:

Type: INT

This method returns the number of data points in the retrieved section. If there are no more marker-delimited sections to retrieve, this method returns 0.

Remarks

A path has an array of data points that define its lines and curves. You can call a path's SetMarker method to designate certain points in the array as markers. Those marker points divide the path into sections.

The first time you call the GraphicsPathIterator::NextMarker method of an iterator, it gets the first marker-delimited section of that iterator's associated path. The second time, it gets the second section, and so on. Each time you call GraphicsPathIterator::NextSubpath, it returns the number of data points in the retrieved section. When there are no sections remaining, it returns 0.

Examples

The following example creates a GraphicsPath object and adds five figures to the path. The calls to the SetMarker method place two markers in the path. The first marker is at the end of a figure, and the second marker is in the middle of a figure. The code passes the address of the GraphicsPath object to a GraphicsPathIterator constructor to create an iterator that is associated with the path. Then the code calls the iterator's GraphicsPathIterator::NextMarker method twice to obtain the second marker-delimited section of the path. Finally, the code draws the retrieved section of the path.

VOID NextMarkerExample(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a graphics path with five figures (subpaths).
   GraphicsPath path;

   path.AddRectangle(Rect(20, 20, 60, 30));
   path.SetMarker();                          // first marker

   path.AddLine(100, 20, 160, 50);
   path.AddArc(180, 20, 60, 30, 0.0f, 180.0f);

   path.AddRectangle(Rect(260, 20, 60, 30));

   path.AddLine(340, 20, 400, 50);
   path.SetMarker();                          // second marker
   path.AddArc(340, 20, 60, 30, 0.0f, 180.0f);
   path.CloseFigure();
  
   path.AddRectangle(Rect(420, 20, 60, 30));
 
   // Create an iterator, and associate it with the path.
   GraphicsPathIterator iterator(&path);

   // Get the second marker-delimited section by calling NextMarker twice.
   GraphicsPath section;
   INT count;
   count = iterator.NextMarker(&section);
   count = iterator.NextMarker(&section);

   // The variable "count" now holds the number of 
   // data points in the second marker-delimited section.

   // Draw the retrieved section.
   Pen bluePen(Color(255, 0, 0, 255));
   graphics.DrawPath(&bluePen, &section);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluspath.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

GraphicsPathIterator

GetPathData

GraphicsPath

NextMarker

GraphicsPathIterator::NextSubpath Methods

Constructing and Drawing Paths

Paths

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012