다음을 통해 공유


PathGradientBrush::GetFocusScales 메서드(gdipluspath.h)

PathGradientBrush::GetFocusScales 메서드는 이 경로 그라데이션 브러시의 포커스 배율을 가져옵니다.

구문

Status GetFocusScales(
  [out] REAL *xScale,
  [out] REAL *yScale
);

매개 변수

[out] xScale

형식: REAL*

x 포커스 배율 값을 받는 REAL 에 대한 포인터입니다.

[out] yScale

형식: REAL*

y 포커스 배율 값을 받는 REAL 에 대한 포인터입니다.

반환 값

형식: 상태

메서드가 성공하면 Status 열거형의 요소인 확인을 반환합니다.

메서드가 실패하면 Status 열거형의 다른 요소 중 하나를 반환합니다.

설명

기본적으로 경로 그라데이션의 가운데 색은 중심점에 있습니다. PathGradientBrush::SetFocusScales를 호출하여 중심점을 둘러싸는 경로를 따라 가운데 색을 표시하도록 지정할 수 있습니다. 예를 들어 경계 경로가 삼각형이고 중심점이 해당 삼각형의 중심점에 있다고 가정합니다. 또한 경계 색이 빨간색이고 가운데 색이 파란색이라고 가정합니다. 포커스 배율을 (0.2, 0.2)로 설정하면 가운데 지점을 둘러싸는 작은 삼각형 경계를 따라 색이 파란색으로 표시됩니다. 이 작은 삼각형은 x 방향에서 0.2, y 방향으로 0.2의 배율로 확장된 기본 경계 경로입니다. 경로 그라데이션 브러시로 칠하면 큰 삼각형의 경계에서 작은 삼각형 경계로 이동할 때 색이 빨간색에서 파란색으로 점차 변경됩니다. 작은 삼각형 안의 영역은 파란색으로 채워집니다.

예제

다음 예제에서는 삼각형 경로를 기반으로 PathGradientBrush 개체를 만듭니다. 이 코드는 경로 그라데이션 브러시의 포커스 눈금을 (0.2, 0.2)로 설정한 다음 경로 그라데이션 브러시를 사용하여 삼각형 경로가 포함된 영역을 채웁니다. 마지막으로, 코드는 PathGradientBrush 개체의 PathGradientBrush::GetFocusScales 메서드를 호출하여 x 포커스 배율 및 y 포커스 눈금의 값을 가져옵니다.

VOID Example_GetFocusScales(HDC hdc)
{
   Graphics graphics(hdc);

   Point points[] = {Point(100, 0), Point(200, 200), Point(0, 200)};

   // No GraphicsPath object is created. The PathGradientBrush
   // object is constructed directly from the array of points.
   PathGradientBrush pthGrBrush(points, 3);

   Color colors[] = {
      Color(255, 255, 0, 0),    // red
      Color(255, 0, 0, 255)};   // blue

   REAL relativePositions[] = {
      0.0f,    // red at the boundary of the outer triangle
      1.0f};   // blue at the boundary of the inner triangle

   pthGrBrush.SetInterpolationColors(colors, relativePositions, 2);

   // The inner triangle is formed by scaling the outer triangle
   // about its centroid. The scaling factor is 0.2 in both
   // the x and y directions.
   pthGrBrush.SetFocusScales(0.2f, 0.2f);

   // Fill a rectangle that is larger than the triangle
   // specified in the Point array. The portion of the
   // rectangle outside the triangle will not be painted.
   graphics.FillRectangle(&pthGrBrush, 0, 0, 200, 200);

   // Obtain information about the path gradient brush.
   REAL xScale = 0.0f;
   REAL yScale = 0.0f;
   pthGrBrush.GetFocusScales(&xScale, &yScale);

   // The value of xScale is now 0.2.
   // The value of yScale is now 0.2. 
}

요구 사항

   
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdipluspath.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

참고 항목

브러시 및 채워진 도형

색 그라데이션으로 도형 채우기

Graphicspath

PathGradientBrush

PathGradientBrush::SetFocusScales