ID2D1SimplifiedGeometrySink::EndFigure 方法 (d2d1.h)

結束目前的圖;選擇性地關閉它。

語法

void EndFigure(
  D2D1_FIGURE_END figureEnd
);

參數

figureEnd

類型: D2D1_FIGURE_END

值,指出目前圖是否已關閉。 如果圖表已關閉,則會在目前點與 BeginFigure 所指定的起點之間繪製線條。

傳回值

備註

呼叫這個方法,而不呼叫 BeginFigure 會將幾何接收置於錯誤狀態;後續呼叫會被忽略,而且呼叫 Close 方法時會傳回整體失敗。

範例

下列範例會建立 ID2D1PathGeometry、擷取接收、使用它來定義沙漏圖形,然後使用 D2D1_FIGURE_END_CLOSED值呼叫 EndFigure ,結束建立時漏。 如需完整的範例,請參閱 如何繪製和填滿複雜圖形

ID2D1GeometrySink *pSink = NULL;


// Create a path geometry.
if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometry);

    if (SUCCEEDED(hr))
    {
        // Write to the path geometry using the geometry sink.
        hr = m_pPathGeometry->Open(&pSink);

        if (SUCCEEDED(hr))
        {
            pSink->BeginFigure(
                D2D1::Point2F(0, 0),
                D2D1_FIGURE_BEGIN_FILLED
                );

            pSink->AddLine(D2D1::Point2F(200, 0));

            pSink->AddBezier(
                D2D1::BezierSegment(
                    D2D1::Point2F(150, 50),
                    D2D1::Point2F(150, 150),
                    D2D1::Point2F(200, 200))
                );

            pSink->AddLine(D2D1::Point2F(0, 200));

            pSink->AddBezier(
                D2D1::BezierSegment(
                    D2D1::Point2F(50, 150),
                    D2D1::Point2F(50, 50),
                    D2D1::Point2F(0, 0))
                );

            pSink->EndFigure(D2D1_FIGURE_END_CLOSED);

            hr = pSink->Close();
        }
        SafeRelease(&pSink);
    }
}

規格需求

需求
最低支援的用戶端 適用於 Windows Vista 的 Windows 7、Windows Vista SP2 和平臺更新 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 d2d1.h
程式庫 D2d1.lib
Dll D2d1.dll

另請參閱

ID2D1SimplifiedGeometrySink