PathGradientBrush.SetSigmaBellShape メソッド

定義

釣鐘型の曲線に基づいて、中心の色から最初の周囲の色に向かって減色していくグラデーションを作成します。

オーバーロード

SetSigmaBellShape(Single)

パスの中心から境界へと外側に向かって色が変化していくグラデーション ブラシを作成します。 色は、釣鐘型の曲線に基づいて、ある色から別の色へと変化していきます。

SetSigmaBellShape(Single, Single)

パスの中心から境界へと外側に向かって色が変化していくグラデーション ブラシを作成します。 色は、釣鐘型の曲線に基づいて、ある色から別の色へと変化していきます。

SetSigmaBellShape(Single)

ソース:
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

パスの中心から境界へと外側に向かって色が変化していくグラデーション ブラシを作成します。 色は、釣鐘型の曲線に基づいて、ある色から別の色へと変化していきます。

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 色がある場合は、配列の最初の色が終了色に使用されます。 この配列で指定された色は、ブラシの境界パス上の個別のポイントに使用される色です。

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

適用対象