다음을 통해 공유


기하 도형 개요

이 개요에서는 ID2D1Geometry 개체를 만들고 사용하여 2D 수치를 정의하고 조작하는 방법을 설명합니다. 여기에는 다음 섹션이 포함되어 있습니다.

Direct2D 기하 도형이란?

Direct2D 기하 도형은 ID2D1Geometry 개체입니다. 이 개체는 간단한 기하 도형(ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometry또는 ID2D1EllipseGeometry수 있습니다. ), 경로 기하 도형(ID2D1PathGeometry) 또는 복합 기하 도형(ID2D1GeometryGroupID2D1TransformedGeometry)입니다.

Direct2D 기하 도형을 사용하면 2차원 수치를 설명하고 적중 테스트 영역, 클립 영역 및 애니메이션 경로 정의와 같은 많은 용도를 제공할 수 있습니다.

Direct2D 기하 도형은 변경할 수 없으며 ID2D1Factory의해 만들어진 디바이스 독립적 리소스입니다. 일반적으로 기하 도형을 한 번 만들어 애플리케이션의 수명 동안 또는 변경해야 할 때까지 유지해야 합니다. 디바이스 독립적 및 디바이스 종속 리소스에 대한 자세한 내용은 리소스 개요참조하세요.

다음 섹션에서는 다양한 종류의 기하 도형에 대해 설명합니다.

단순 기하 도형

간단한 기하 도형에는 ID2D1RectangleGeometry, ID2D1RoundedRectangleGeometryID2D1EllipseGeometry 개체가 포함되며 사각형, 둥근 사각형, 원 및 줄임표와 같은 기본 기하 도형을 만드는 데 사용할 수 있습니다.

간단한 기하 도형을 만들려면 ID2D1Factory::Create<geometryType>Geometry 메서드 중 하나를 사용합니다. 이러한 메서드는 지정된 형식의 개체를 만듭니다. 예를 들어 사각형을 만들려면 ID2D1Factory::CreateRectangleGeometry호출합니다. 이 ID2D1RectangleGeometry 개체를 반환합니다. 둥근 사각형을 만들려면 ID2D1RoundedRectangleGeometry 개체를 반환하는 ID2D1Factory::CreateRoundedRectangleGeometry호출합니다.

다음 코드 예제에서는 CreateEllipseGeometry 메서드를 호출하여 가운데(100, 100), x-반경 100으로y-반경 50으로 설정된 타원 구조를 전달합니다. Then, it calls DrawGeometry, passing in the returned ellipse geometry, a pointer to a black ID2D1SolidColorBrush, and a stroke width of 5. 다음 그림에서는 코드 예제의 출력을 보여 줍니다.

타원의 그림

ID2D1EllipseGeometry *m_pEllipseGeometry;
if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreateEllipseGeometry(
        D2D1::Ellipse(D2D1::Point2F(100.f, 60.f), 100.f, 50.f),
        &m_pEllipseGeometry
        );
}
m_pRenderTarget->DrawGeometry(m_pEllipseGeometry, m_pBlackBrush, 5);

기하 도형의 윤곽선을 그리려면 DrawGeometry 메서드를 사용합니다. 내부를 그리려면 FillGeometry 메서드를 사용합니다.

경로 기하 도형

경로 기하 도형은 ID2D1PathGeometry 인터페이스로 표시됩니다. 이러한 개체는 호, 곡선 및 선과 같은 세그먼트로 구성된 복잡한 기하학적 그림을 설명하는 데 사용할 수 있습니다. 다음 그림에서는 경로 기하 도형을 사용하여 만든 드로잉을 보여 줍니다.

강과 산과 태양의 그림

자세한 내용 및 예제는 경로 기하 도형 개요참조하세요.

복합 기하 도형

복합 기하 도형은 다른 기하 도형 개체 또는 변환과 그룹화되거나 결합된 기하 도형입니다. 복합 기하 도형에는 ID2D1TransformedGeometryID2D1GeometryGroup 개체가 포함됩니다.

Geometry groups

기하 도형 그룹은 여러 기하 도형을 동시에 그룹화하여 여러 고유 기하 도형의 모든 피규어를 하나로 연결할 수 있는 편리한 방법입니다. To create a ID2D1GeometryGroup object, call the CreateGeometryGroup method on the ID2D1Factory object, passing in the fillMode with possible values of D2D1_FILL_MODE_ALTERNATE (alternate) and D2D1_FILL_MODE_WINDING, an array of geometry objects to add to the geometry group, and the number of elements in this array.

다음 코드 예제에서는 먼저 기하 도형 개체의 배열을 선언합니다. 이러한 개체는 반지름이 25, 50, 75 및 100인 4개의 동심원입니다. 그런 다음 ID2D1Factory 개체에서 CreateGeometryGroup 호출하여 D2D1_FILL_MODE_ALTERNATE, 기하 도형 그룹에 추가할 기하 도형 개체 배열 및 이 배열의 요소 수를 전달합니다.

ID2D1Geometry *ppGeometries[] =
{
    m_pEllipseGeometry1,
    m_pEllipseGeometry2,
    m_pEllipseGeometry3,
    m_pEllipseGeometry4
};

hr = m_pD2DFactory->CreateGeometryGroup(
    D2D1_FILL_MODE_ALTERNATE,
    ppGeometries,
    ARRAYSIZE(ppGeometries),
    &m_pGeoGroup_AlternateFill
    );

if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreateGeometryGroup(
        D2D1_FILL_MODE_WINDING,
        ppGeometries,
        ARRAYSIZE(ppGeometries),
        &m_pGeoGroup_WindingFill
        );
}

다음 그림에서는 예제에서 두 그룹 기하 도형을 렌더링한 결과를 보여 줍니다.

illustration of two sets of four concentric circles, one with alternating rings filled and one with all rings filled

변형된 기하 도형

기하 도형을 변환하는 방법에는 여러 가지가 있습니다. 렌더링 대상의 SetTransform 메서드를 사용하여 렌더링 대상이 그리는 모든 항목을 변환하거나 CreateTransformedGeometry 메서드를 사용하여 변환을 기하 도형과 직접 연결하여 ID2D1TransformedGeometry만들 수 있습니다.

사용해야 하는 메서드는 원하는 효과에 따라 달라집니다. 렌더링 대상을 사용하여 기하 도형을 변환한 다음 렌더링하는 경우 변형은 적용한 스트로크의 너비를 포함하여 기하 도형에 대한 모든 항목에 영향을 줍니다. 반면에 id2D1TransformedGeometry사용하는 경우 변환은 셰이프를 설명하는 좌표에만 영향을 줍니다. 기하 도형을 그릴 때 변환은 스트로크 두께에 영향을 미치지 않습니다.

메모

Starting with Windows 8 the world transform will not affect the stroke thickness of strokes with D2D1_STROKE_TRANSFORM_TYPE_FIXEDor D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE. 이러한 변환 형식을 사용하여 변환에 의존하지 않는 스트로크를 사용해야 합니다.

 

다음 예제에서는 ID2D1RectangleGeometry을 만든 다음 변환하지 않고 그립니다. 다음 그림에 표시된 출력을 생성합니다.

illustration of a rectangle

hr = m_pD2DFactory->CreateRectangleGeometry(
    D2D1::RectF(150.f, 150.f, 200.f, 200.f),
    &m_pRectangleGeometry
    );
// Draw the untransformed rectangle geometry.
m_pRenderTarget->DrawGeometry(m_pRectangleGeometry, m_pBlackBrush, 1);

다음 예제에서는 렌더링 대상을 사용하여 기하 도형의 크기를 3으로 조정한 다음 그립니다. 다음 그림은 변환을 적용하지 않고 사각형을 그린 결과와 변환을 적용하여 사각형을 그린 결과를 보여 줍니다. 스트로크 두께가 1인 경우에도 변환 후 스트로크가 더 두껍습니다.

큰 사각형 안에 더 작은 사각형이 있는, 두꺼운 스트로크의 그림

// Transform the render target, then draw the rectangle geometry again.
m_pRenderTarget->SetTransform(
    D2D1::Matrix3x2F::Scale(
        D2D1::SizeF(3.f, 3.f),
        D2D1::Point2F(175.f, 175.f))
    );

m_pRenderTarget->DrawGeometry(m_pRectangleGeometry, m_pBlackBrush, 1);

다음 예제에서는 CreateTransformedGeometry 메서드를 사용하여 기하 도형의 크기를 3으로 조정한 다음 그립니다. 다음 그림에 표시된 출력을 생성합니다. 직사각형은 더 크지만 스트로크는 증가하지 않았습니다.

스트로크 두께가 같은 더 큰 사각형 내의 작은 사각형 그림

 // Create a geometry that is a scaled version
 // of m_pRectangleGeometry.
 // The new geometry is scaled by a factory of 3
 // from the center of the geometry, (35, 35).

 hr = m_pD2DFactory->CreateTransformedGeometry(
     m_pRectangleGeometry,
     D2D1::Matrix3x2F::Scale(
         D2D1::SizeF(3.f, 3.f),
         D2D1::Point2F(175.f, 175.f)),
     &m_pTransformedGeometry
     );
// Replace the previous render target transform.
m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());

// Draw the transformed geometry.
m_pRenderTarget->DrawGeometry(m_pTransformedGeometry, m_pBlackBrush, 1);

마스크로서의 기하 도형

PushLayer 메서드를 호출할 때 ID2D1Geometry 개체를 기하학적 마스크로 사용할 수 있습니다. 기하학적 마스크는 렌더링 대상에 합성되는 레이어의 영역을 지정합니다. 자세한 내용은 레이어 개요기하학적 마스크 섹션을 참조하세요.

기하학적 연산

ID2D1Geometry 인터페이스는 기하학적 그림을 조작하고 측정하는 데 사용할 수 있는 몇 가지 기하학적 연산을 제공합니다. 예를 들어 해당 경계를 계산하고 반환하는 데 사용할 수 있으며, 한 기하 도형이 다른 기하 도형과 공간적으로 어떻게 관련되어 있는지(적중 테스트에 유용), 영역 및 길이 등을 계산할 수 있습니다. 다음 표에서는 일반적인 기하학적 연산에 대해 설명합니다.

수술 메서드
결합하다 CombineWithGeometry
Bounds/ Widened Bounds/Retrieve Bounds, Dirty Region update Widen, GetBounds, GetWidenedBounds
Hit Testing FillContainsPoint, StrokeContainsPoint
뇌졸중 StrokeContainsPoint
비교 기하학과 비교
Simplification (removes arcs and quadratic Bezier curves) 단순화
Tessellation 테셀레이트
Outline (remove intersection) 개요
기하 도형의 영역 또는 길이 계산 ComputeArea, ComputeLength, ComputePointAtLength

 

메모

Windows 8부터 ID2D1PathGeometry1ComputePointAndSegmentAtLength 메서드를 사용하여 기하 도형의 영역 또는 길이를 계산할 수 있습니다.

 

기하학 결합

한 기하 도형을 다른 기하 도형과 결합하려면 ID2D1Geometry::CombineWithGeometry 메서드를 호출합니다. 기하학적 도형을 결합할 때에는 결합 작업을 수행하는 네 가지 방법 중 하나를 지정합니다: D2D1_COMBINE_MODE_UNION (합집합), D2D1_COMBINE_MODE_INTERSECT (교차), D2D1_COMBINE_MODE_XOR (XOR) 및 D2D1_COMBINE_MODE_EXCLUDE (제외). 다음 코드 예제에서는 통합 결합 모드를 사용하여 결합된 두 개의 원을 보여 줍니다. 여기서 첫 번째 원은 중심점(75, 75)과 반지름이 50이고 두 번째 원은 중심점(125, 75)과 반경이 50입니다.

HRESULT hr = S_OK;
ID2D1GeometrySink *pGeometrySink = NULL;

// Create the first ellipse geometry to merge.
const D2D1_ELLIPSE circle1 = D2D1::Ellipse(
    D2D1::Point2F(75.0f, 75.0f),
    50.0f,
    50.0f
    );

hr = m_pD2DFactory->CreateEllipseGeometry(
    circle1,
    &m_pCircleGeometry1
    );

if (SUCCEEDED(hr))
{
    // Create the second ellipse geometry to merge.
    const D2D1_ELLIPSE circle2 = D2D1::Ellipse(
        D2D1::Point2F(125.0f, 75.0f),
        50.0f,
        50.0f
        );

    hr = m_pD2DFactory->CreateEllipseGeometry(circle2, &m_pCircleGeometry2);
}


if (SUCCEEDED(hr))
{
    //
    // Use D2D1_COMBINE_MODE_UNION to combine the geometries.
    //
    hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometryUnion);

    if (SUCCEEDED(hr))
    {
        hr = m_pPathGeometryUnion->Open(&pGeometrySink);

        if (SUCCEEDED(hr))
        {
            hr = m_pCircleGeometry1->CombineWithGeometry(
                m_pCircleGeometry2,
                D2D1_COMBINE_MODE_UNION,
                NULL,
                NULL,
                pGeometrySink
                );
        }

        if (SUCCEEDED(hr))
        {
            hr = pGeometrySink->Close();
        }

        SafeRelease(&pGeometrySink);
    }
}

The following illustration shows two circles combined with a combine mode of union.

두 개의 겹치는 원이 통합된 그림

모든 결합 모드의 일러스트레이션은 D2D1_COMBINE_MODE 열거형참조하세요.

Widen

The Widen method generates a new geometry whose fill is equivalent to stroking the existing geometry, and then writes the result to the specified ID2D1SimplifiedGeometrySink object. 다음 코드 예제에서는 ID2D1PathGeometry 개체에서 Open 호출합니다. Open이 성공하면 기하 도형 개체에서 Widen를 호출합니다.

ID2D1GeometrySink *pGeometrySink = NULL;
hr = pPathGeometry->Open(&pGeometrySink);
if (SUCCEEDED(hr))
{
    hr = pGeometry->Widen(
            strokeWidth,
            pIStrokeStyle,
            pWorldTransform,
            pGeometrySink
            );

테셀레이트(Tessellate)

The Tessellate method creates a set of clockwise-wound triangles that cover the geometry after it is transformed by using the specified matrix and flattened by using the specified tolerance. 다음 코드 예제에서는 Tessellate 사용하여 pPathGeometry나타내는 삼각형 목록을 만듭니다. 삼각형은 ID2D1Mesh, pMesh저장한 다음, 나중에 렌더링할 때 사용할 수 있도록 클래스 멤버인 m_pStrokeMesh전송됩니다.

ID2D1Mesh *pMesh = NULL;
hr = m_pRT->CreateMesh(&pMesh);
if (SUCCEEDED(hr))
{
    ID2D1TessellationSink *pSink = NULL;
    hr = pMesh->Open(&pSink);
    if (SUCCEEDED(hr))
    {
        hr = pPathGeometry->Tessellate(
                NULL, // world transform (already handled in Widen)
                pSink
                );
        if (SUCCEEDED(hr))
        {
            hr = pSink->Close();
            if (SUCCEEDED(hr))
            {
                SafeReplace(&m_pStrokeMesh, pMesh);
            }
        }
        pSink->Release();
    }
    pMesh->Release();
}

FillContainsPoint and StrokeContainsPoint

FillContainsPoint 메서드는 기하 도형으로 채워진 영역에 지정된 점이 포함되어 있는지 여부를 나타냅니다. 이 메서드를 사용하여 적중 테스트를 수행할 수 있습니다. 다음 코드 예제에서는 ID2D1EllipseGeometry 개체에서 FillContainsPoint 호출하여 지점(0,0)과 ID 행렬을 전달합니다.

BOOL containsPoint1;
hr = m_pCircleGeometry1->FillContainsPoint(
    D2D1::Point2F(0,0),
    D2D1::Matrix3x2F::Identity(),
    &containsPoint1
    );

if (SUCCEEDED(hr))
{
    // Process containsPoint.
}

StrokeContainsPoint 메서드는 기하 도형의 스트로크에 지정된 점이 포함되어 있는지 여부를 결정합니다. 이 메서드를 사용하여 적중 테스트를 수행할 수 있습니다. 다음 코드 예제에서는 StrokeContainsPoint사용합니다.

BOOL containsPoint;

hr = m_pCircleGeometry1->StrokeContainsPoint(
    D2D1::Point2F(0,0),
    10,     // stroke width
    NULL,   // stroke style
    NULL,   // world transform
    &containsPoint
    );

if (SUCCEEDED(hr))
{
    // Process containsPoint.
}

간소화하다

Simplify 메서드는 지정된 기하 도형에서 호 및 이차 베지어 곡선을 제거합니다. 따라서 결과 기하 도형에는 선과 선택적으로 입방형 베지어 곡선만 포함됩니다. 다음 코드 예제에서는 단순화를 사용하여 베지어 곡선이 있는 기하 도형을 선 세그먼트만 포함하는 기하 도형으로 변환합니다.

HRESULT D2DFlatten(
    ID2D1Geometry *pGeometry,
    float flatteningTolerance,
    ID2D1Geometry **ppGeometry
    )
{
    HRESULT hr;
    ID2D1Factory *pFactory = NULL;
    pGeometry->GetFactory(&pFactory);

    ID2D1PathGeometry *pPathGeometry = NULL;
    hr = pFactory->CreatePathGeometry(&pPathGeometry);

    if (SUCCEEDED(hr))
    {
        ID2D1GeometrySink *pSink = NULL;
        hr = pPathGeometry->Open(&pSink);

        if (SUCCEEDED(hr))
        {
            hr = pGeometry->Simplify(
                    D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,
                    NULL, // world transform
                    flatteningTolerance,
                    pSink
                    );

            if (SUCCEEDED(hr))
            {
                hr = pSink->Close();

                if (SUCCEEDED(hr))
                {
                    *ppGeometry = pPathGeometry;
                    (*ppGeometry)->AddRef();
                }
            }
            pSink->Release();
        }
        pPathGeometry->Release();
    }

    pFactory->Release();

    return hr;
}

ComputeLength and ComputeArea

ComputeLength 메서드는 각 세그먼트가 선으로 언롤된 경우 지정된 기하 도형의 길이를 계산합니다. 여기에는 기하 도형이 닫힌 경우 암시적 닫는 세그먼트가 포함됩니다. 다음 코드 예제에서는 ComputeLength 사용하여 지정된 원(m_pCircleGeometry1)의 길이를 계산합니다.

float length;

// Compute the area of circle1
hr = m_pCircleGeometry1->ComputeLength(
    D2D1::IdentityMatrix(),
    &length
    );

if (SUCCEEDED(hr))
{
    // Process the length of the geometry.
}

ComputeArea 메서드는 지정된 기하 도형의 영역을 계산합니다. 다음 코드 예제에서는 ComputeArea 사용하여 지정된 원(m_pCircleGeometry1)의 영역을 계산합니다.

float area;

// Compute the area of circle1
hr = m_pCircleGeometry1->ComputeArea(
    D2D1::IdentityMatrix(),
    &area
    );

기하학과비교

CompareWithGeometry 메서드는 이 메서드를 호출하는 기하 도형과 지정된 기하 도형 간의 교집합을 설명합니다. The possible values for intersection include D2D1_GEOMETRY_RELATION_DISJOINT (disjoint), D2D1_GEOMETRY_RELATION_IS_CONTAINED (is contained), D2D1_GEOMETRY_RELATION_CONTAINS (contains), and D2D1_GEOMETRY_RELATION_OVERLAP (overlap). "disjoint" means that two geometry fills do not intersect at all. "포함됨"은 기하 도형이 지정된 기하 도형에 완전히 포함되어 있음을 의미합니다. "contains"는 기하 도형이 지정된 기하 도형을 완전히 포함한다는 의미이고, "겹침"은 두 기하 도형이 서로 겹치지만 어느 것도 다른 것을 완전히 포함하지 않는다는 의미입니다.

다음 코드 예제에서는 반경이 50이지만 오프셋이 50인 두 원을 비교하는 방법을 보여 줍니다.

HRESULT hr = S_OK;
ID2D1GeometrySink *pGeometrySink = NULL;

// Create the first ellipse geometry to merge.
const D2D1_ELLIPSE circle1 = D2D1::Ellipse(
    D2D1::Point2F(75.0f, 75.0f),
    50.0f,
    50.0f
    );

hr = m_pD2DFactory->CreateEllipseGeometry(
    circle1,
    &m_pCircleGeometry1
    );

if (SUCCEEDED(hr))
{
    // Create the second ellipse geometry to merge.
    const D2D1_ELLIPSE circle2 = D2D1::Ellipse(
        D2D1::Point2F(125.0f, 75.0f),
        50.0f,
        50.0f
        );

    hr = m_pD2DFactory->CreateEllipseGeometry(circle2, &m_pCircleGeometry2);
}

D2D1_GEOMETRY_RELATION result = D2D1_GEOMETRY_RELATION_UNKNOWN;

// Compare circle1 with circle2
hr = m_pCircleGeometry1->CompareWithGeometry(
    m_pCircleGeometry2,
    D2D1::IdentityMatrix(),
    0.1f,
    &result
    );

if (SUCCEEDED(hr))
{
    static const WCHAR szGeometryRelation[] = L"Two circles overlap.";
    m_pRenderTarget->SetTransform(D2D1::IdentityMatrix());
    if (result == D2D1_GEOMETRY_RELATION_OVERLAP)
    {
        m_pRenderTarget->DrawText(
            szGeometryRelation,
            ARRAYSIZE(szGeometryRelation) - 1,
            m_pTextFormat,
            D2D1::RectF(25.0f, 160.0f, 200.0f, 300.0f),
            m_pTextBrush
            );
    }
}

개요

Outline 함수는 기하 도형의 윤곽선(자체 또는 다른 도형과 교차하지 않는 형태의 기하 도형의 버전)을 계산하고, 결과를 ID2D1SimplifiedGeometrySink에 기록합니다. 다음 코드 예제에서는 개요 사용하여 자체 교집합 없이 동등한 기하 도형을 생성합니다. It uses the default flattening tolerance.

HRESULT D2DOutline(
    ID2D1Geometry *pGeometry,
    ID2D1Geometry **ppGeometry
    )
{
    HRESULT hr;
    ID2D1Factory *pFactory = NULL;
    pGeometry->GetFactory(&pFactory);

    ID2D1PathGeometry *pPathGeometry = NULL;
    hr = pFactory->CreatePathGeometry(&pPathGeometry);

    if (SUCCEEDED(hr))
    {
        ID2D1GeometrySink *pSink = NULL;
        hr = pPathGeometry->Open(&pSink);

        if (SUCCEEDED(hr))
        {
            hr = pGeometry->Outline(NULL, pSink);

            if (SUCCEEDED(hr))
            {
                hr = pSink->Close();

                if (SUCCEEDED(hr))
                {
                    *ppGeometry = pPathGeometry;
                    (*ppGeometry)->AddRef();
                }
            }
            pSink->Release();
        }
        pPathGeometry->Release();
    }

    pFactory->Release();

    return hr;
}

GetBounds and GetWidenedBounds

GetBounds 메서드는 기하 도형의 경계를 검색합니다. 다음 코드 예제에서는 GetBounds 사용하여 지정된 원(m_pCircleGeometry1)의 범위를 검색합니다.

D2D1_RECT_F bounds;

hr = m_pCircleGeometry1->GetBounds(
      D2D1::IdentityMatrix(),
      &bounds
     );

if (SUCCEEDED(hr))
{
    // Retrieve the bounds.
}

GetWidenedBounds 메서드는 지정된 스트로크 너비와 스타일에 의해 확장되고 지정된 행렬에 의해 변환된 후 기하 도형의 범위를 검색합니다. 다음 코드 예제에서는 GetWidenedBounds 사용하여 지정된 스트로크 너비로 확장된 후 지정된 원(m_pCircleGeometry1)의 범위를 검색합니다.

float dashes[] = {1.f, 1.f, 2.f, 3.f, 5.f};

m_pD2DFactory->CreateStrokeStyle(
    D2D1::StrokeStyleProperties(
        D2D1_CAP_STYLE_FLAT,
        D2D1_CAP_STYLE_FLAT,
        D2D1_CAP_STYLE_ROUND,
        D2D1_LINE_JOIN_ROUND,   // lineJoin
        10.f,   //miterLimit
        D2D1_DASH_STYLE_CUSTOM,
        0.f     //dashOffset
        ),
     dashes,
     ARRAYSIZE(dashes)-1,
     &m_pStrokeStyle
     );
D2D1_RECT_F bounds1;
hr = m_pCircleGeometry1->GetWidenedBounds(
      5.0,
      m_pStrokeStyle,
      D2D1::IdentityMatrix(),
      &bounds1
     );
if (SUCCEEDED(hr))
{
    // Retrieve the widened bounds.
}

ComputePointAtLength

ComputePointAtLength 메서드는 기하 도형을 따라 지정된 거리에서 점 및 탄젠트 벡터를 계산합니다. 다음 코드 예제에서는 ComputePointAtLength사용합니다.

D2D1_POINT_2F point;
D2D1_POINT_2F tangent;

hr = m_pCircleGeometry1->ComputePointAtLength(
    10, 
    NULL, 
    &point, 
    &tangent); 

경로 기하 도형 개요

Direct2D Reference