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

O método PathGradientBrush::GetBlend obtém os fatores de mesclagem e as posições de mesclagem correspondentes definidas atualmente para esse pincel de gradiente de caminho.

Sintaxe

Status GetBlend(
  [out] REAL *blendFactors,
  [out] REAL *blendPositions,
  [in]  INT  count
);

Parâmetros

[out] blendFactors

Tipo: REAL*

Ponteiro para uma matriz que recebe os fatores de mesclagem.

[out] blendPositions

Tipo: REAL*

Ponteiro para uma matriz que recebe as posições de mesclagem.

[in] count

Tipo: INT

Inteiro que especifica o número de fatores de mesclagem a serem recuperados. Antes de chamar o método PathGradientBrush::GetBlend de um objeto PathGradientBrush , chame o método PathGradientBrush::GetBlendCount do mesmo objeto PathGradientBrush para determinar o número atual de fatores de mesclagem. O número de posições de mesclagem recuperadas é o mesmo que o número de fatores de mesclagem recuperados.

Valor retornado

Tipo: Status

Se o método for bem-sucedido, ele retornará Ok, que é um elemento da enumeração Status .

Se o método falhar, ele retornará um dos outros elementos da enumeração Status .

Comentários

Um objeto PathGradientBrush tem um caminho de limite e um ponto central. Quando você preenche uma área com um pincel de gradiente de caminho, a cor muda gradualmente à medida que você passa do caminho de limite para o ponto central. Por padrão, a cor está linearmente relacionada à distância, mas você pode personalizar a relação entre cor e distância chamando o método PathGradientBrush::SetBlend .

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

Graphicspath

LinearGradientBrush

Pathgradientbrush

PathGradientBrush::GetBlendCount

PathGradientBrush::SetBlend

PathGradientBrush::SetCenterColor

Métodos PathGradientBrush::SetCenterPoint

PathGradientBrush::SetSurroundColors

Caminhos