Share via


PathGradientBrush.SetSigmaBellShape 메서드

정의

종 모양의 곡선을 기반으로 가운데 색과 첫째 주변 색 사이의 그라데이션 대칭을 만듭니다.

오버로드

SetSigmaBellShape(Single)

경로의 가운데에서 시작하여 가장자리로 향하는 색을 변경하는 그라데이션 브러시를 만듭니다. 한 색에서 다른 색으로의 전환은 종 모양의 곡선을 기반으로 합니다.

SetSigmaBellShape(Single, Single)

경로의 가운데에서 시작하여 가장자리로 향하는 색을 변경하는 그라데이션 브러시를 만듭니다. 한 색에서 다른 색으로의 전환은 종 모양의 곡선을 기반으로 합니다.

SetSigmaBellShape(Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
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)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
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 Forms 사용하도록 설계되었으며 이벤트 개체인 가 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 경우 배열의 첫 번째 색이 끝 색에 사용됩니다. 이 배열에 지정된 색은 브러시 경계 경로의 불연속 지점에 사용되는 색입니다.

기본적으로 경로 그라데이션의 경계에서 가운데 지점으로 이동하면 색이 경계 색에서 가운데 색으로 점진적으로 변경됩니다. 이 메서드를 호출하여 경계 및 가운데 색의 위치 지정 및 혼합을 사용자 지정할 수 있습니다.

적용 대상