Share via


GraphicsPathIterator ::CopyData, méthode (gdipluspath.h)

La méthode GraphicsPathIterator ::CopyData copie un sous-ensemble des points de données du chemin d’accès vers un tableau PointF et copie un sous-ensemble des types de points du chemin vers un tableau BYTE .

Syntaxe

INT CopyData(
  [out] PointF *points,
  [out] BYTE   *types,
  [in]  INT    startIndex,
  [in]  INT    endIndex
);

Paramètres

[out] points

Type : PointF*

Pointeur vers un tableau qui reçoit un sous-ensemble des points de données du chemin d’accès.

[out] types

Type : BYTE*

Pointeur vers un tableau qui reçoit un sous-ensemble des types de points du chemin d’accès.

[in] startIndex

Type : INT

Entier qui spécifie l’index de départ des points et des types à copier.

[in] endIndex

Type : INT

Entier qui spécifie l’index de fin des points et des types à copier.

Valeur retournée

Type : INT

Cette méthode retourne le nombre de points copiés. Cela correspond au nombre de types copiés.

Remarques

Cet objet GraphicsPathIterator est associé à un objet GraphicsPath . Cet objet GraphicsPath a un tableau de points et un tableau de types. Chaque élément du tableau de types est un octet qui spécifie le type de point et un ensemble d’indicateurs pour l’élément correspondant dans le tableau de points. Les types de points et indicateurs possibles sont répertoriés dans l’énumération PathPointType .

Vous pouvez appeler la méthode GraphicsPathIterator ::GetCount pour déterminer le nombre de points de données dans le chemin.

Exemples

L’exemple suivant crée un objet GraphicsPath et ajoute trois lignes au chemin d’accès. Le code crée un objet GraphicsPathIterator> et appelle sa méthode GraphicsPathIterator ::CopyData pour récupérer les points et les types de points du chemin d’accès. Ensuite, le code affiche le nombre retourné par la méthode GraphicsPathIterator ::CopyData .


#define BUFFER_SIZE 30
TCHAR numPointsCopied[BUFFER_SIZE];

// Create the points for three lines in a path.
Point pts[] = { Point(20, 20), 
                Point(100, 20), 
                Point(100, 50), 
                Point(20, 50) };
GraphicsPath path;
path.AddLines(pts, 4); // Add the lines to the path.

// Create a GraphicsPathIterator object and associate it with the path. 
GraphicsPathIterator pathIterator(&path);

// Create destination arrays, and copy the path data to them.
PointF* pCopiedPoints = new PointF[4]; 
BYTE* pTypes = new BYTE[4];
INT count = pathIterator.CopyData(pCopiedPoints, pTypes, 0, 3);

// Confirm that the points copied.
StringCchPrintf(
   numPointsCopied, BUFFER_SIZE, TEXT("%d points were copied."), count);

MessageBox(hWnd, numPointsCopied, TEXT("CopyData"), NULL);

delete[] pCopiedPoints;
delete[] pTypes;

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows XP, Windows 2000 Professionnel [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête gdipluspath.h (inclure Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Génération et dessin de tracés

GetPathData

Méthodes GetPathPoints

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator ::Énumérer

GraphicsPathIterator ::GetCount

Chemins d’accès