次の方法で共有


PathGradientBrush.SetSigmaBellShape メソッド

定義

ベルの形をした曲線に基づいて、中心の色と最初の周囲の色との間にグラデーションのフォールオフを作成します。

オーバーロード

SetSigmaBellShape(Single)

パスの中心からパスの境界まで外側に向かって色を変更するグラデーション ブラシを作成します。 ある色から別の色への遷移は、ベルの形をした曲線に基づいています。

SetSigmaBellShape(Single, Single)

パスの中心からパスの境界まで外側に向かって色を変更するグラデーション ブラシを作成します。 ある色から別の色への遷移は、ベルの形をした曲線に基づいています。

SetSigmaBellShape(Single)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs

パスの中心からパスの境界まで外側に向かって色を変更するグラデーション ブラシを作成します。 ある色から別の色への遷移は、ベルの形をした曲線に基づいています。

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

パラメーター

focus
Single

パスの中心からパスの境界までの放射状に沿って中心の色が最も高くなる場所を指定する 0 ~ 1 の値。 値が 1 (既定値) の場合、パスの中心に最も高い強度が設定されます。

例については、SetSigmaBellShapeを参照してください。

注釈

SurroundColors 配列に複数の色がある場合は、配列の最初の色が終了色に使用されます。 この配列で指定された色は、ブラシの境界パス上の不連続ポイントに使用される色です。

既定では、パス グラデーションの境界から中心点に移動すると、色は境界の色から中心の色に徐々に変化します。 このメソッドを呼び出すことで、境界と中心の色の配置とブレンドをカスタマイズできます。

適用対象

SetSigmaBellShape(Single, Single)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs

パスの中心からパスの境界まで外側に向かって色を変更するグラデーション ブラシを作成します。 ある色から別の色への遷移は、ベルの形をした曲線に基づいています。

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)

パラメーター

focus
Single

パスの中心からパスの境界までの放射状に沿って中心の色が最も高くなる場所を指定する 0 ~ 1 の値。 値が 1 (既定値) の場合、パスの中心に最も高い強度が設定されます。

scale
Single

境界の色とブレンドされる中心色の最大強度を指定する 0 ~ 1 の値。 値が 1 の場合、中心の色が可能な限り高くなります。既定値です。

次のコード例は、Windows フォームで使用できるように設計されており、OnPaint イベント オブジェクトである PaintEventArgseが必要です。 このコードは、次のアクションを実行します。

  • グラフィックス パスを作成し、四角形を追加します。

  • パスポイントから PathGradientBrush を作成します (この例では、ポイントは四角形を形成しますが、ほとんどの図形になります)。

  • 中心の色を赤に、周囲の色を青に設定します。

  • ブレンド変換を適用する前に、画面に PathGradientBrush を描画します。

  • SetSigmaBellShape メソッドを使用して、ブレンド変換をブラシに適用します。

  • TranslateTransform メソッドを呼び出して、前に画面に描画された四角形をオーバーレイしないようにブラシの四角形を移動します。

  • 変換されたブラシの四角形を画面に描画します。

最大の中心の色 (赤) は、パスの中心からパスの境界までの途中に配置されていることに注意してください。

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

注釈

SurroundColors 配列に複数の色がある場合は、配列の最初の色が終了色に使用されます。 この配列で指定された色は、ブラシの境界パス上の不連続ポイントに使用される色です。

既定では、パス グラデーションの境界から中心点に移動すると、色は境界の色から中心の色に徐々に変化します。 このメソッドを呼び出すことで、境界と中心の色の配置とブレンドをカスタマイズできます。

適用対象