smourier / DirectN

Direct interop Code for .NET Framework, .NET Core and .NET 5+ : DXGI, WIC, DirectX 9 to 12, Direct2D, Direct Write, Direct Composition, Media Foundation, WASAPI, CodecAPI, GDI, Spatial Audio, DVD, Windows Media Player, UWP DXInterop, WinUI3, etc.
MIT License
311 stars 28 forks source link

D2D1_LAYER_PARAMETERS1 geometricMask #17

Closed miquik closed 2 years ago

miquik commented 2 years ago

Hi, I'm try to fill D2D1_LAYER_PARAMETERS1 structure to call PushLayer. If I understand correctly I have to pass my clipping geometry (as ID2D1Geometry) in the geometricMask field of this structure.

But how should I convert ID2D1Geometry to IntPtr?

Thanks

smourier commented 2 years ago

Hi,

You can use Marshal.GetIUnknownForObject(geometryObject)

miquik commented 2 years ago

Thanks @smourier . For some reason your solution doesn't work. Anyway I got it worked using: Marshal.GetComInterfaceForObject(clip, typeof(ID2D1Geometry));

Thanks again