문제

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