コード例 #1
0
ID2D1PathGeometry* Direct2DLowLevelGraphicsContext::pathToPathGeometry (const Path& path, const AffineTransform& transform)
{
    ID2D1PathGeometry* p = nullptr;
    Direct2DFactories::getInstance().d2dFactory->CreatePathGeometry (&p);

    ComSmartPtr <ID2D1GeometrySink> sink;
    HRESULT hr = p->Open (sink.resetAndGetPointerAddress());
    sink->SetFillMode (D2D1_FILL_MODE_WINDING); // xxx need to check Path::isUsingNonZeroWinding()

    pathToGeometrySink (path, sink, transform);

    hr = sink->Close();
    return p;
}
コード例 #2
0
ID2D1PathGeometry* Direct2DLowLevelGraphicsContext::rectListToPathGeometry (const RectangleList& clipRegion)
{
    ID2D1PathGeometry* p = nullptr;
    Direct2DFactories::getInstance().d2dFactory->CreatePathGeometry (&p);

    ComSmartPtr <ID2D1GeometrySink> sink;
    HRESULT hr = p->Open (sink.resetAndGetPointerAddress()); // xxx handle error
    sink->SetFillMode (D2D1_FILL_MODE_WINDING);

    for (int i = clipRegion.getNumRectangles(); --i >= 0;)
        rectToGeometrySink (clipRegion.getRectangle(i), sink);

    hr = sink->Close();
    return p;
}