Retrieve ID2D1DeviceContext from IDirect3DDevice9

I am using Source Reader to read video samples from a video file, and decode them using decoder then I am rendering these samples using DirectX9.

I am using IDirect3DDevice9 for rendering video frames, and it is working as expected.

Now I want to add in Chroma-key Effect, a described in below like:

https://msdn.microsoft.com/en-us/library/windows/desktop/dn890715(v=vs.85).aspx

So how do I get ID2D1DeviceContext from IDirect3DDevice9 and then add Chorma-key effect to it and then render the video frame?


ID2D1DeviceContext requires DirectX11 device and can not be used with obsolete IDirect3DDevice9. Typically you create objects in the following order: DXGI Factory, D2D1 Factory, D3D11 Device, DXGI Device, D2D1 Device and then finally D2D1 Device Context. You may want to check D2D getting starting guide and samples.

There is no real point in dealing with DirectX9 anymore, unless you are forced to provide backward compatibility for Windows XP. Chroma-key sample you posted requires Windows 10.