Share via


Método PathGradientBrush::GetBlendCount (gdipluspath.h)

El método PathGradientBrush::GetBlendCount obtiene el número de factores de mezcla establecidos actualmente para este pincel de degradado de ruta de acceso.

Sintaxis

INT GetBlendCount();

Valor devuelto

Tipo: INT

Este método devuelve el número de factores de mezcla establecidos actualmente para este pincel de degradado de trazado.

Comentarios

Antes de llamar al método PathGradientBrush::GetBlend de un objeto PathGradientBrush , debe asignar dos búferes: uno para recibir una matriz de factores de mezcla y otro para recibir una matriz de posiciones de mezcla. Para determinar el tamaño de los búferes necesarios, llame al método PathGradientBrush::GetBlendCount del objeto PathGradientBrush . El tamaño (en bytes) de cada búfer debe ser el valor devuelto de PathGradientBrush::GetBlendCount multiplicado por sizeof( REAL).

Ejemplos

En el ejemplo siguiente se muestran varios métodos de la clase PathGradientBrush , incluidos PathGradientBrush::SetBlend, PathGradientBrush::GetBlendCount y PathGradientBrush::GetBlend. El código crea un objeto PathGradientBrush y llama al método PathGradientBrush::SetBlend para establecer un conjunto de factores de mezcla y posiciones de mezcla para el pincel. A continuación, el código llama al método PathGradientBrush::GetBlendCount para recuperar el número de factores de mezcla. Una vez recuperado el número de factores de mezcla, el código asigna dos búferes: uno para recibir la matriz de factores de mezcla y otro para recibir la matriz de posiciones de mezcla. A continuación, el código llama al método PathGradientBrush::GetBlend para recuperar los factores de mezcla y las posiciones de mezcla.

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; 
}

Requisitos

   
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

Pinceles y formas rellenas

Crear un degradado de trazado

Rellenar una forma con un degradado de color

PathGradientBrush

PathGradientBrush::GetBlend

PathGradientBrush::SetBlend