Partilhar via


PathGradientBrush.SetSigmaBellShape Método

Definição

Cria uma queda de gradiente entre a cor de centro e a primeira cor ao redor com base em uma curva em forma de sino.

Sobrecargas

SetSigmaBellShape(Single)

Cria um pincel de gradiente que muda de cor do centro do caminho para fora até o limite do caminho. A transição de uma cor para outra se baseia em uma curva em forma de sino.

SetSigmaBellShape(Single, Single)

Cria um pincel de gradiente que muda de cor do centro do caminho para fora até o limite do caminho. A transição de uma cor para outra se baseia em uma curva em forma de sino.

SetSigmaBellShape(Single)

Origem:
PathGradientBrush.cs
Origem:
PathGradientBrush.cs
Origem:
PathGradientBrush.cs

Cria um pincel de gradiente que muda de cor do centro do caminho para fora até o limite do caminho. A transição de uma cor para outra se baseia em uma curva em forma de sino.

public:
 void SetSigmaBellShape(float focus);
public void SetSigmaBellShape (float focus);
member this.SetSigmaBellShape : single -> unit
Public Sub SetSigmaBellShape (focus As Single)

Parâmetros

focus
Single

Um valor entre 0 e 1 que especifica em que ponto, ao longo de qualquer radial do centro do caminho até o limite do caminho, a cor central estará em sua intensidade mais alta. Um valor de 1 (o padrão) coloca a intensidade mais alta no centro do caminho.

Exemplos

Para ver um exemplo, consulte SetSigmaBellShape.

Comentários

Se houver mais de uma cor na SurroundColors matriz, a primeira cor na matriz será usada para a cor final. As cores especificadas nesta matriz são cores usadas para pontos discretos no caminho de limite do pincel.

Por padrão, à medida que você passa do limite de um gradiente de caminho para o ponto central, a cor muda gradualmente da cor do limite para a cor central. Você pode personalizar o posicionamento e a mesclagem das cores de limite e centro chamando esse método.

Aplica-se a

SetSigmaBellShape(Single, Single)

Origem:
PathGradientBrush.cs
Origem:
PathGradientBrush.cs
Origem:
PathGradientBrush.cs

Cria um pincel de gradiente que muda de cor do centro do caminho para fora até o limite do caminho. A transição de uma cor para outra se baseia em uma curva em forma de sino.

public:
 void SetSigmaBellShape(float focus, float scale);
public void SetSigmaBellShape (float focus, float scale);
member this.SetSigmaBellShape : single * single -> unit
Public Sub SetSigmaBellShape (focus As Single, scale As Single)

Parâmetros

focus
Single

Um valor entre 0 e 1 que especifica em que ponto, ao longo de qualquer radial do centro do caminho até o limite do caminho, a cor central estará em sua intensidade mais alta. Um valor de 1 (o padrão) coloca a intensidade mais alta no centro do caminho.

scale
Single

Um valor entre 0 e 1 que especifica a intensidade máxima da cor central que é combinada à cor do limite. Um valor de 1 causa a intensidade mais alta possível da cor central e é o valor padrão.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, um OnPaint objeto de evento. O código executa as seguintes ações:

  • Cria um caminho gráfico e adiciona um retângulo a ele.

  • Cria um PathGradientBrush dos pontos de caminho (neste exemplo, os pontos formam um retângulo, mas pode ser a maioria de qualquer forma).

  • Define a cor central como vermelho e a cor ao redor como azul.

  • Desenha o PathGradientBrush na tela antes de aplicar a transformação de mesclagem.

  • Aplica a transformação de mesclagem ao pincel usando seu SetSigmaBellShape método .

  • Chama o TranslateTransform método para mover o retângulo do pincel de modo que ele não sobreponha aquele desenhado para a tela anteriormente.

  • Desenha o retângulo de pincel transformado na tela.

Observe que a cor central máxima (vermelho) está localizada a meio caminho do centro do caminho até o limite do caminho.

public:
   void SetSigmaBellShapeExample( PaintEventArgs^ e )
   {
      // Create a graphics path and add a rectangle.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle rect = Rectangle(100,20,100,50);
      myPath->AddRectangle( rect );

      // Get the path's array of points.
      array<PointF>^myPathPointArray = myPath->PathPoints;

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // Set the color span.
      myPGBrush->CenterColor = Color::Red;
      array<Color>^ mySurroundColor = {Color::Blue};
      myPGBrush->SurroundColors = mySurroundColor;

      // Draw the brush to the screen prior to blend.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Set the Blend factors and transform the brush.
      myPGBrush->SetSigmaBellShape( 0.5f, 1.0f );

      // Move the brush down by 100 by applying the translate
      // transform to the brush.
      myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append );

      // Draw the brush to the screen again after setting the
      // blend and applying the transform.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
   }
public void SetSigmaBellShapeExample(PaintEventArgs e)
{
             
    // Create a graphics path and add a rectangle.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle rect = new Rectangle(100, 20, 100, 50);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // Set the color span.
    myPGBrush.CenterColor = Color.Red;
    Color[] mySurroundColor = {Color.Blue};
    myPGBrush.SurroundColors = mySurroundColor;
             
    // Draw the brush to the screen prior to blend.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Set the Blend factors and transform the brush.
    myPGBrush.SetSigmaBellShape(0.5f, 1.0f);
             
    // Move the brush down by 100 by applying the translate
    // transform to the brush.
    myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append);
             
    // Draw the brush to the screen again after setting the
    // blend and applying the transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub SetSigmaBellShapeExample(ByVal e As PaintEventArgs)

    ' Create a graphics path and add a rectangle.
    Dim myPath As New GraphicsPath
    Dim rect As New Rectangle(100, 20, 100, 50)
    myPath.AddRectangle(rect)

    ' Get the path's array of points.
    Dim myPathPointArray As PointF() = myPath.PathPoints

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' Set the color span.
    myPGBrush.CenterColor = Color.Red
    Dim mySurroundColor As Color() = {Color.Blue}
    myPGBrush.SurroundColors = mySurroundColor

    ' Draw the brush to the screen prior to blend.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Set the Blend factors.
    myPGBrush.SetSigmaBellShape(0.5F, 1.0F)

    ' Move the brush down by 100 by applying the translate
    ' transform to the brush.
    myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append)

    ' Draw the brush to the screen again after setting the
    ' blend and applying the transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub

Comentários

Se houver mais de uma cor na SurroundColors matriz, a primeira cor na matriz será usada para a cor final. As cores especificadas nesta matriz são cores usadas para pontos discretos no caminho de limite do pincel.

Por padrão, à medida que você passa do limite de um gradiente de caminho para o ponto central, a cor muda gradualmente da cor do limite para a cor central. Você pode personalizar o posicionamento e a mesclagem das cores de limite e centro chamando esse método.

Aplica-se a