GraphicsPathIterator::NextSubpath(constGraphicsPath*,BOOL*) (gdipluspath.h)

El método GraphicsPathIterator::NextSubpath obtiene la siguiente figura (subpath) de la ruta de acceso asociada de este iterador.

Sintaxis

INT NextSubpath(
  [out] const GraphicsPath *path,
  [out] BOOL               *isClosed
);

Parámetros

[out] path

Tipo: GraphicsPath*

Puntero a un objeto GraphicsPath . Este método establece los puntos de datos de este objeto GraphicsPath para que coincidan con los puntos de datos de la figura recuperada.

[out] isClosed

Tipo: BOOL*

Puntero a un BOOL que recibe un valor que indica si la figura recuperada está cerrada. Si se cierra la figura, el valor recibido es TRUE; de lo contrario, el valor recibido es FALSE.

Valor devuelto

Tipo: INT

Este método devuelve el número de puntos de datos de la figura recuperada. Si no hay más cifras que recuperar, este método devuelve 0.

Comentarios

La primera vez que se llama al método GraphicsPathIterator::NextSubpath de un iterador, obtiene la primera figura (subpath) de esa ruta de acceso asociada del iterador. La segunda vez, obtiene la segunda figura, etc. Cada vez que se llama a GraphicsPathIterator::NextSubpath, devuelve el número de puntos de datos de la figura recuperada. Cuando no quedan cifras, devuelve 0.

Ejemplos

En el ejemplo siguiente se crea un objeto GraphicsPath y se agregan cinco figuras (también denominadas subrutas) a la ruta de acceso. El código pasa la dirección del objeto GraphicsPath a un constructor GraphicsPathIterator para crear un iterador asociado a la ruta de acceso. El código llama al método GraphicsPathIterator::NextSubpath del iterador dos veces para recuperar la segunda figura (subpath) de la ruta de acceso. A continuación, el código llama al método DrawPath de un objeto Graphics para dibujar esa subruta individual.


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

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

   path.AddRectangle(Rect(20, 20, 60, 30));   // Subpath count is 1.

   path.AddLine(100, 20, 160, 50);            // Subpath count is 2.
   path.AddArc(180, 20, 60, 30, 0.0f, 180.0f);

   path.AddRectangle(Rect(260, 20, 60, 30));  // Subpath count is 3.

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

   // Get the second subpath by calling NextSubpath twice.
   GraphicsPath subpath;
   BOOL isClosed;
   INT count;
   count = iterator.NextSubpath(&subpath, &isClosed);
   count = iterator.NextSubpath(&subpath, &isClosed);

   // The variable "count" now holds the number of 
   // data points in the second subpath.

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

Requisitos

Requisito Value
Cliente mínimo compatible Windows XP, Windows 2000 Professional [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows 2000 Server [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado gdipluspath.h (incluya Gdiplus.h)
Library Gdiplus.lib
Archivo DLL Gdiplus.dll

Consulte también

Crear y dibujar trazados

GetPathData

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::GetSubpathCount

GraphicsPathIterator::NextMarker (Métodos)

NextSubpath

Paths