In WPF I can use the following:
var texture = (INuiFrameTexture) Marshal.GetObjectForIUnknown(frame.pFrameTexture);
My INuiFrameTexture looks like this:
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("00000000-0000-0000-C000-000000000046")]
internal interface INuiFrameTexture {
[PreserveSig]
int BufferLen();
[PreserveSig]
int Pitch();
[PreserveSig]
HRESULT LockRect(uint Level,ref NuiLockedRect pLockedRect,ref IntPtr pRect,uint Flags);
[PreserveSig]
HRESULT GetLevelDesc(uint Level, NuiSurfaceDesc pDesc);
[PreserveSig]
HRESULT UnlockRect([In] uint Level);
}
Now I'm trying to achieve the same in Silverlight but the framework has no GetObjectForIUnknown method. Does anybody know if there is a way to do this in Silverlight?