/// <summary> /// Marshal the image from native if not already marshaled. /// </summary> private void EnsureMarshalled() { if (!nativeFrame.HasValue) { nativeFrame = (NUI_FUSION_IMAGE_FRAME)Marshal.PtrToStructure( NativeFrameHandle.ToIntPtr(Handle), typeof(NUI_FUSION_IMAGE_FRAME)); } }
/// <summary> /// Convert a NativeFrameHandle to IntPtr. /// </summary> /// <param name="frameHandle">The NativeFrameHandle to be converted.</param> /// <returns> /// Returns IntPtr.Zero if the input NativeFrameHandle is null or the underlying IntPtr value. /// </returns> public static IntPtr ToIntPtr(NativeFrameHandle frameHandle) { return(null != frameHandle ? frameHandle.handle : IntPtr.Zero); }
/// <summary> /// Convert a FusionImageFrame to HandleRef structure. /// </summary> /// <param name="imageFrame">The FusionImageFrame to be converted.</param> /// <returns> /// Returns null if the input <para>imageFrame</para> is null or a HandleRef structure. /// </returns> public static HandleRef ToHandleRef(FusionImageFrame imageFrame) { return(null != imageFrame ? new HandleRef(imageFrame, NativeFrameHandle.ToIntPtr(imageFrame.Handle)) : new HandleRef()); }
/// <summary> /// Convert a NativeFrameHandle to IntPtr. /// </summary> /// <param name="frameHandle">The NativeFrameHandle to be converted.</param> /// <returns> /// Returns IntPtr.Zero if the input NativeFrameHandle is null or the underlying IntPtr value. /// </returns> public static IntPtr ToIntPtr(NativeFrameHandle frameHandle) { return null != frameHandle ? frameHandle.handle : IntPtr.Zero; }