在 WPF 中,我可以使用以下内容:
var texture = (INuiFrameTexture) Marshal.GetObjectForIUnknown(frame.pFrameTexture);
我的 INuiFrameTexture 看起来像这样:
[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);
}
现在我试图在 Silverlight 中实现相同的目标,但该框架没有 GetObjectForIUnknown 方法。有人知道在 Silverlight 中是否有办法做到这一点?