PathGradientBrush.SetBlendTriangularShape 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
가운데에 다른 색이 있으며, 주변에 있는 다른 한 색과 선형 대칭을 이루는 선형 그라데이션을 만듭니다.
오버로드
SetBlendTriangularShape(Single) |
가운데에 다른 색이 있으며, 주변에 있는 다른 한 색과 선형 대칭을 이루는 선형 그라데이션을 만듭니다. |
SetBlendTriangularShape(Single, Single) |
가운데에 다른 색이 있으며, 주변에 있는 각 색과 선형 대칭을 이루는 선형 그라데이션을 만듭니다. |
SetBlendTriangularShape(Single)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
가운데에 다른 색이 있으며, 주변에 있는 다른 한 색과 선형 대칭을 이루는 선형 그라데이션을 만듭니다.
public:
void SetBlendTriangularShape(float focus);
public void SetBlendTriangularShape (float focus);
member this.SetBlendTriangularShape : single -> unit
Public Sub SetBlendTriangularShape (focus As Single)
매개 변수
- focus
- Single
경로의 가운데에서 가장자리까지 반지름을 따라 가운데 색의 농도가 가장 높은 위치를 지정하는 0에서 1 사이의 값입니다. 경로 가운데에 있는 농도가 가장 높은 위치가 기본값(1)입니다.
예제
예제는 다음을 참조하세요. SetBlendTriangularShape.
설명
배열에 색이 두 개 이상 있는 SurroundColors 경우 배열의 첫 번째 색이 끝 색에 사용됩니다. 이 배열에 지정된 색은 브러시의 경계 경로에 있는 불연속 지점에 사용됩니다.
적용 대상
SetBlendTriangularShape(Single, Single)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
가운데에 다른 색이 있으며, 주변에 있는 각 색과 선형 대칭을 이루는 선형 그라데이션을 만듭니다.
public:
void SetBlendTriangularShape(float focus, float scale);
public void SetBlendTriangularShape (float focus, float scale);
member this.SetBlendTriangularShape : single * single -> unit
Public Sub SetBlendTriangularShape (focus As Single, scale As Single)
매개 변수
- focus
- Single
경로의 가운데에서 가장자리까지 반지름을 따라 가운데 색의 농도가 가장 높은 위치를 지정하는 0에서 1 사이의 값입니다. 경로 가운데에 있는 농도가 가장 높은 위치가 기본값(1)입니다.
- scale
- Single
가장자리 색과 혼합되는 가운데 색의 최대 농도를 지정하는 0에서 1사이의 값입니다. 기본값인 1은 가운데 색에 사용할 수 있는 가장 높은 농도를 나타냅니다.
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 이 OnPaint 필요합니다PaintEventArgse
. 코드는 다음 작업을 수행합니다.
그래픽 경로를 만들고 사각형을 추가합니다.
경로 지점에서 를 PathGradientBrush 만듭니다(이 예제에서는 점이 사각형을 형성하지만 대부분의 셰이프일 수 있음).
가운데 색을 빨간색으로 설정하고 주변 색을 파란색으로 설정합니다.
PathGradientBrush 혼합 변환을 적용하기 전에 를 화면에 그립니다.
메서드를 사용하여 브러시에 혼합 변환을 적용합니다 SetBlendTriangularShape .
메서드를 TranslateTransform 호출하여 이전에 화면에 그린 브러시 사각형을 오버레이하지 않도록 브러시 사각형을 이동합니다.
변환된 브러시 사각형을 화면에 그립니다.
최대 가운데 색(빨간색)은 경로의 중심에서 경로 경계까지의 절반 정도에 위치합니다.
public:
void SetBlendTriangularShapeExample( 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 the blend.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );
// Set the Blend factors.
myPGBrush->SetBlendTriangularShape( 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 applying the
// transforms.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
}
public void SetBlendTriangularShapeExample(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 the blend.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
// Set the Blend factors.
myPGBrush.SetBlendTriangularShape(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 applying the
// transforms.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub SetBlendTriangularShapeExample(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.SetBlendTriangularShape(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 applying the
' transforms.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub
설명
배열에 색이 두 개 이상 있는 SurroundColors 경우 배열의 첫 번째 색이 끝 색에 사용됩니다. 이 배열에 지정된 색은 브러시의 경계 경로에 있는 불연속 지점에 사용되는 색입니다.
기본적으로 경로 그라데이션의 경계에서 가운데 지점으로 이동하면 경계 색에서 가운데 색으로 색이 점차 변경됩니다. 이 메서드를 호출하여 경계 및 가운데 색의 위치 지정 및 혼합을 사용자 지정할 수 있습니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기