ID2D1SimplifiedGeometrySink::BeginFigure 方法 (d2d1.h)

在指定的點啟動新的圖形。

語法

void BeginFigure(
  D2D1_POINT_2F     startPoint,
  D2D1_FIGURE_BEGIN figureBegin
);

參數

startPoint

類型: D2D1_POINT_2F

要開始新圖的點。

figureBegin

類型: D2D1_FIGURE_BEGIN

新圖形應該是空心或填滿。

傳回值

備註

如果在圖形正在進行時呼叫這個方法,介面就會失效,而且所有未來的方法都會失敗。

範例

下列範例會建立 ID2D1PathGeometry、擷取接收,並使用它來定義沙漏形狀。

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

路徑幾何概觀