/** * @brief Unlock the previously acquired buffer. * @param[in] data The sample data storage previously acquired. * @return PXCM_STATUS_NO_ERROR Successful execution. */ public pxcmStatus ReleaseAccess(ImageData data) { ImageDataNative dataNative = data as ImageDataNative; if (dataNative == null) { return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID); } if (dataNative.native == IntPtr.Zero) { return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID); } pxcmStatus sts = PXCMImage_ReleaseAccess(instance, dataNative.native); Marshal.FreeHGlobal(dataNative.native); dataNative.native = IntPtr.Zero; return(sts); }
/** * @brief Lock to access the internal storage of a specified format. The function will perform format conversion if unmatched. * @param[in] access The access mode. * @param[in] format The requested smaple format. * @param[in] options The option flags. * @param[out] data The sample data storage, to be returned. * @return PXCM_STATUS_NO_ERROR Successful execution. */ public pxcmStatus AcquireAccess(Access access, PixelFormat format, Option options, out ImageData data) { ImageDataNative dataNative = new ImageDataNative(); dataNative.native = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ImageDataNative))); data = dataNative; pxcmStatus sts = PXCMImage_AcquireAccess(instance, access, format, options, dataNative.native); if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR) { IntPtr native = dataNative.native; Marshal.PtrToStructure(dataNative.native, dataNative); dataNative.native = native; } else { Marshal.FreeHGlobal(dataNative.native); dataNative.native = IntPtr.Zero; } return(sts); }
/** @brief Lock to access the internal storage of a specified format. The function will perform format conversion if unmatched. @param[in] access The access mode. @param[in] format The requested smaple format. @param[in] options The option flags. @param[out] data The sample data storage, to be returned. @return PXCM_STATUS_NO_ERROR Successful execution. */ public pxcmStatus AcquireAccess(Access access, PixelFormat format, Option options, out ImageData data) { ImageDataNative dataNative = new ImageDataNative(); dataNative.native = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ImageDataNative))); data = dataNative; pxcmStatus sts = PXCMImage_AcquireAccess(instance, access, format, options, dataNative.native); if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR) { IntPtr native = dataNative.native; Marshal.PtrToStructure(dataNative.native, dataNative); dataNative.native = native; } else { Marshal.FreeHGlobal(dataNative.native); dataNative.native = IntPtr.Zero; } return sts; }