다음을 통해 공유


PathGradientBrush.SetSigmaBellShape 메서드

정의

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

오버로드

SetSigmaBellShape(Single)

경로의 중심에서 바깥쪽으로 경로 경계로 색을 변경하는 그라데이션 브러시를 만듭니다. 한 색에서 다른 색으로의 전환은 종 모양의 곡선을 기반으로 합니다.

SetSigmaBellShape(Single, Single)

경로의 중심에서 바깥쪽으로 경로 경계로 색을 변경하는 그라데이션 브러시를 만듭니다. 한 색에서 다른 색으로의 전환은 종 모양의 곡선을 기반으로 합니다.

SetSigmaBellShape(Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
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
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 배열에 두 개 이상의 색이 있는 경우 배열의 첫 번째 색이 끝 색에 사용됩니다. 이 배열에 지정된 색은 브러시 경계 경로의 불연속 지점에 사용되는 색입니다.

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

적용 대상