本文共 1439 字,大约阅读时间需要 4 分钟。
D2D不仅可以绘制,还可以对多个几何图形对象进行空间运算。这功能应该在GIS界比较吃香。
这些计算包括:
pRenderTarget->BeginDraw(); //clear screen pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White)); //define 2 ellipse const D2D1_ELLIPSE ellipse1 = Ellipse(Point2F(200,300),150,150); const D2D1_ELLIPSE ellipse2 = Ellipse(Point2F(200,250),100,200); //define ellipse geometry for compute ID2D1EllipseGeometry* pEllipse1 = NULL; ID2D1EllipseGeometry* pEllipse2 = NULL; //define path for render the combine result ID2D1PathGeometry* pPathGeo = NULL; //define a path container ID2D1GeometrySink* pGeometrySink = NULL; //initialize the ellipses and path. hr = pD2DFactory->CreateEllipseGeometry(ellipse1, &pEllipse1); hr = pD2DFactory->CreateEllipseGeometry(ellipse2, &pEllipse2); hr = pD2DFactory->CreatePathGeometry(&pPathGeo); //begin add path pPathGeo->Open(&pGeometrySink); //combine the 2 ellipse and the result go into the sink pEllipse1->CombineWithGeometry(pEllipse2, D2D1_COMBINE_MODE_UNION, NULL, NULL, pGeometrySink); //end add path pGeometrySink->Close(); //draw the path pRenderTarget->DrawGeometry(pPathGeo, pBlackBrush); pRenderTarget->EndDraw();
转载地址:http://qmlgb.baihongyu.com/