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

O método PathGradientBrush::GetBlendCount obtém o número de fatores de mesclagem atualmente definidos para esse pincel de gradiente de caminho.

Sintaxe

INT GetBlendCount();

Valor retornado

Tipo: INT

Esse método retorna o número de fatores de mesclagem atualmente definidos para esse pincel de gradiente de caminho.

Comentários

Antes de chamar o método PathGradientBrush::GetBlend de um objeto PathGradientBrush , você deve alocar dois buffers: um para receber uma matriz de fatores de mesclagem e outro para receber uma matriz de posições de mesclagem. Para determinar o tamanho dos buffers necessários, chame o método PathGradientBrush::GetBlendCount do objeto PathGradientBrush . O tamanho (em bytes) de cada buffer deve ser o valor retornado de PathGradientBrush::GetBlendCount multiplicado por sizeof( REAL).

Exemplos

O exemplo a seguir demonstra vários métodos da classe PathGradientBrush , incluindo PathGradientBrush::SetBlend, PathGradientBrush::GetBlendCount e PathGradientBrush::GetBlend. O código cria um objeto PathGradientBrush e chama o método PathGradientBrush::SetBlend para estabelecer um conjunto de fatores de combinação e posições de mesclagem para o pincel. Em seguida, o código chama o método PathGradientBrush::GetBlendCount para recuperar o número de fatores de mesclagem. Depois que o número de fatores de mesclagem é recuperado, o código aloca dois buffers: um para receber a matriz de fatores de mesclagem e outro para receber a matriz de posições de mesclagem. Em seguida, o código chama o método PathGradientBrush::GetBlend para recuperar os fatores de mesclagem e as posições de mesclagem.

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 com suporte Windows XP, Windows 2000 Professional [somente aplicativos da área de trabalho]
Servidor mínimo com suporte Windows 2000 Server [somente aplicativos da área de trabalho]
Plataforma de Destino Windows
Cabeçalho gdipluspath.h (inclua Gdiplus.h)
Biblioteca Gdiplus.lib
DLL Gdiplus.dll

Confira também

Pincéis e formas preenchidas

Criando um Gradiente de Caminho

Preenchendo uma forma com um gradiente de cor

Pathgradientbrush

PathGradientBrush::GetBlend

PathGradientBrush::SetBlend