PathGradientBrush::SetBlend-Methode (gdipluspath.h)

Die PathGradientBrush::SetBlend-Methode legt die Mischungsfaktoren und die Blendpositionen dieses Pfadverlaufspinsels fest.

Syntax

Status SetBlend(
  [in] const REAL *blendFactors,
  [in] const REAL *blendPositions,
  [in] INT        count
);

Parameter

[in] blendFactors

Typ: REAL*

Zeiger auf ein Array von Mischfaktoren. Jede Zahl im Array sollte im Bereich 0 bis 1 liegen.

[in] blendPositions

Typ: REAL*

Zeiger auf ein Array von Mischpositionen. Jede Zahl im Array sollte im Bereich 0 bis 1 liegen.

[in] count

Typ: INT

Ganzzahl, die die Anzahl der Elemente im BlendFactors-Array angibt. Dies entspricht der Anzahl der Elemente im Array blendPositions .

Rückgabewert

Typ: Status

Wenn die Methode erfolgreich ist, gibt sie OK zurück, ein Element der Status-Enumeration .

Wenn die Methode fehlschlägt, gibt sie eines der anderen Elemente der Status-Enumeration zurück.

Hinweise

Ein PathGradientBrush-Objekt verfügt über einen Begrenzungspfad und einen Mittelpunkt. Wenn Sie einen Bereich mit einem Pfadverlaufspinsel füllen, ändert sich die Farbe allmählich, wenn Sie vom Begrenzungspfad zum Mittelpunkt wechseln. Standardmäßig ist die Farbe linear mit der Entfernung verknüpft, Aber Sie können die Beziehung zwischen Farbe und Entfernung anpassen, indem Sie die PathGradientBrush::SetBlend-Methode aufrufen.

Beispiele

Im folgenden Beispiel wird ein PathGradientBrush-Objekt basierend auf einer Ellipse erstellt. Der Code ruft die PathGradientBrush::SetBlend-Methode des PathGradientBrush-Objekts auf, um eine Reihe von Blendfaktoren und Blendpositionen für den Pinsel einzurichten. Anschließend verwendet der Code den Pfadverlaufspinsel, um die Auslassungspunkte zu füllen.

VOID Example_SetBlend(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);  
}

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

Weitere Informationen

Pinsel und gefüllte Formen

Farbe

Erstellen eines Pfadverlaufs

Füllen einer Form mit einem Farbverlauf

Graphicspath

Pathgradientbrush

PathGradientBrush::GetBlend

PathGradientBrush::GetBlendCount