Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Die PathGradientBrush::GetBlendCount-Methode ruft die Anzahl von Blendfaktoren ab, die derzeit für diesen Pfadverlaufspinsel festgelegt sind.
Syntax
INT GetBlendCount();
Rückgabewert
Typ: INT
Diese Methode gibt die Anzahl von Blendfaktoren zurück, die derzeit für diesen Pfadfarbverlaufspinsel festgelegt sind.
Hinweise
Bevor Sie die PathGradientBrush::GetBlend-Methode eines PathGradientBrush-Objekts aufrufen, müssen Sie zwei Puffer zuordnen: einen, um ein Array von Blendfaktoren zu empfangen, und einer zum Empfangen eines Arrays von Blendpositionen. Um die Größe der erforderlichen Puffer zu bestimmen, rufen Sie die PathGradientBrush::GetBlendCount-Methode des PathGradientBrush-Objekts auf. Die Größe (in Bytes) jedes Puffers sollte der Rückgabewert von PathGradientBrush::GetBlendCount multipliziert mit sizeof( REAL) sein.
Beispiele
Im folgenden Beispiel werden mehrere Methoden der PathGradientBrush-Klasse veranschaulicht, einschließlich PathGradientBrush::SetBlend, PathGradientBrush::GetBlendCount und PathGradientBrush::GetBlend. Der Code erstellt ein PathGradientBrush-Objekt und ruft die PathGradientBrush::SetBlend-Methode auf, um eine Reihe von Blendfaktoren und Blendpositionen für den Pinsel festzulegen. Anschließend ruft der Code die PathGradientBrush::GetBlendCount-Methode auf, um die Anzahl der Blendfaktoren abzurufen. Nachdem die Anzahl der Blendfaktoren abgerufen wurde, weist der Code zwei Puffer zu: einen zum Empfangen des Arrays von Blendfaktoren und einen zum Empfangen des Arrays der Mischpositionen. Anschließend ruft der Code die PathGradientBrush::GetBlend-Methode auf, um die Mischfaktoren und die Blendpositionen abzurufen.
VOID Example_GetBlend(HDC hdc)
{
Graphics graphics(hdc);
// Create a path that consists of a single ellipse.
GraphicsPath path;
path.AddEllipse(0, 0, 200, 100);
// Use the path to construct a brush.
PathGradientBrush pthGrBrush(&path);
// Set the color at the center of the path to blue.
pthGrBrush.SetCenterColor(Color(255, 0, 0, 255));
// Set the color along the entire boundary of the path to aqua.
Color colors[] = {Color(255, 0, 255, 255)};
INT count = 1;
pthGrBrush.SetSurroundColors(colors, &count);
// Set blend factors and positions for the path gradient brush.
REAL fac[] = {
0.0f,
0.4f, // 40 percent of the way from aqua to blue
0.8f, // 80 percent of the way from aqua to blue
1.0f};
REAL pos[] = {
0.0f,
0.3f, // 30 percent of the way from the boundary to the center
0.7f, // 70 percent of the way from the boundary to the center
1.0f};
pthGrBrush.SetBlend(fac, pos, 4);
// Fill the ellipse with the path gradient brush.
graphics.FillEllipse(&pthGrBrush, 0, 0, 200, 100);
// Obtain information about the path gradient brush.
INT blendCount = pthGrBrush.GetBlendCount();
REAL* factors = new REAL[blendCount];
REAL* positions = new REAL[blendCount];
pthGrBrush.GetBlend(factors, positions, blendCount);
for(INT j = 0; j < blendCount; ++j)
{
// Inspect or use the value in factors[j].
// Inspect or use the value in positions[j].
}
delete [] factors;
delete [] positions;
}
Anforderungen
Unterstützte Mindestversion (Client) | Windows XP, Windows 2000 Professional [nur Desktop-Apps] |
Unterstützte Mindestversion (Server) | Windows 2000 Server [nur Desktop-Apps] |
Zielplattform | Windows |
Kopfzeile | gdipluspath.h (include Gdiplus.h) |
Bibliothek | Gdiplus.lib |
DLL | Gdiplus.dll |