質問

In my Windows Store application, I have to draw the Path geometry using Direct2D in C++. In my scenario instead of using basic Polyline object, i go for Direct2D for better performance in my application. So my C# application will communicate with the C++ component for the Direct2D drawing.

This link helped to get more information about Direct2D drawing for PathGeometry. But it draws the geometry in the Window Handle but rather than using Window handle i need the drawing to be done as like the ordinary UIElement rendering. Is there any sample available over the net to resolve my problem ?

役に立ちましたか?

解決 2

We have to use the factory that created the SurfaceImageSource; We should not create a new factory. So our will have code like this:

 ID2D1Factory *pFactory=nullptr;
 d2dDevice->GetFactory(&pFactory);
 ID2D1GeometrySink *pSink = NULL;
 ID2D1PathGeometry *pPathGeometry=NULL;
 // Create a path geometry.
 HRESULT hr = pFactory->CreatePathGeometry(&pPathGeometry);

Finally it solved my problem.

他のヒント

There are samples for DirectX/XAML integration and I think there might even be a VS project template for integrating these that includes Direct2D code, though possibly in a single project natice C++ app, whereas you would need to create a native WinRT component that exposes a C++/CX API to your application to put in either a SwapChainPanel (best option, but requires Windows 8.1), SwapChainBackgroundPanel (good option, but full-screen only) or a SurfaceImageSource.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top