diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..4675876 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,33 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + +[[package]] +name = "ohos-drawing-sys" +version = "0.1.1" +dependencies = [ + "document-features", +] + +[[package]] +name = "ohos-sys" +version = "0.3.0" +dependencies = [ + "document-features", + "ohos-drawing-sys", +] diff --git a/Cargo.toml b/Cargo.toml index 5372c3b..ffc197b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,8 @@ hilog = [] napi = [] ## Enables bindings to `native_buffer` native_buffer = ['native_window'] +## Enables bindings to `native_image` +native_image = ['native_window'] ## Enables bindings to `native_window` native_window = ['native_buffer'] ## Enables bindings to `native_vsync` diff --git a/scripts/generate_bindings.sh b/scripts/generate_bindings.sh index 0de8f70..e7b0ad0 100755 --- a/scripts/generate_bindings.sh +++ b/scripts/generate_bindings.sh @@ -119,6 +119,19 @@ bindgen "${BASE_BINDGEN_ARGS[@]}" \ -x c++ \ "${BASE_CLANG_ARGS[@]}" +bindgen "${BASE_BINDGEN_ARGS[@]}" \ + --raw-line="use crate::native_window::OHNativeWindow;" \ + --allowlist-file ".*/native_image/.*\.h" \ + --blocklist-item '^(OH)?NativeWindow?$' \ + --default-enum-style=newtype \ + --no-copy '^OH_NativeImage$' \ + --no-copy 'OH_OnFrameAvailableListener' \ + --no-debug '^OH_NativeImage$' \ + --output "${ROOT_DIR}/src/native_image/native_image_api${OHOS_API_VERSION}.rs" \ + "${OHOS_SYSROOT_DIR}/usr/include/native_image/native_image.h" \ + -- \ + "${BASE_CLANG_ARGS[@]}" + # NativeWindowOperation has wrong documentation for one of the parameters in API 10. block_native_window_operation="" if [[ ${OHOS_API_VERSION} -eq 10 ]]; then diff --git a/src/lib.rs b/src/lib.rs index 1f0c534..f130b04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,10 @@ pub mod napi; #[cfg_attr(docsrs, doc(cfg(feature = "native_buffer")))] pub mod native_buffer; +#[cfg(feature = "native_image")] +#[cfg_attr(docsrs, doc(cfg(feature = "native_image")))] +pub mod native_image; + #[cfg(feature = "native_window")] #[cfg_attr(docsrs, doc(cfg(feature = "native_window")))] pub mod native_window; diff --git a/src/native_image.rs b/src/native_image.rs new file mode 100644 index 0000000..a10e83a --- /dev/null +++ b/src/native_image.rs @@ -0,0 +1,36 @@ +//! Bindings to `native_image` +//! +//! The native image module is used for associating a surface with an OpenGL external texture. +//! It functions as the consumer of a graphics queue. +//! You can use the APIs of this module to obtain and use a buffer, and output the buffer content to an OpenGL external texture. +//! +//! The following scenario is common for native image development: +//! +//! Use the native image APIs to create an OH_NativeImage instance as the consumer and obtain the corresponding OHNativeWindow instance (functioning as the producer). +//! Use the native window APIs to fill in and flush the buffer, and then use the native image APIs to update the buffer content to an OpenGL ES texture. +//! +//! Source: [Official Native Image documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/graphics/native-image-guidelines.md) +//! + +#[link(name = "EGL")] +#[link(name = "GLESv3")] +#[link(name = "native_image")] +extern "C" {} + +mod native_image_api10; +pub use native_image_api10::*; + +#[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] +mod api11_additions; +#[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] +pub use api11_additions::*; + +#[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] +mod api12_additions; + +#[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] +pub use api12_additions::*; diff --git a/src/native_image/api11_additions.rs b/src/native_image/api11_additions.rs new file mode 100644 index 0000000..6d67343 --- /dev/null +++ b/src/native_image/api11_additions.rs @@ -0,0 +1,58 @@ +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +use super::OH_NativeImage; + +/** @brief The callback function of frame available. + +@syscap SystemCapability.Graphic.Graphic2D.NativeImage +@param context User defined context, returned to the user in the callback function +@since 11 +@version 1.0*/ +pub type OH_OnFrameAvailable = + ::core::option::Option; +/** @brief A listener for native image, use OH_NativeImage_SetOnFrameAvailableListener to register \n +the listener object to OH_NativeImage, the callback will be triggered when there is available frame + +@since 11 +@version 1.0*/ +#[repr(C)] +#[derive(Debug)] +pub struct OH_OnFrameAvailableListener { + /// User defined context, returned to the user in the callback function + pub context: *mut ::core::ffi::c_void, + /// The callback function of frame available. + pub onFrameAvailable: OH_OnFrameAvailable, +} + +extern "C" { + /** @brief Return the native image's surface id. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param surfaceId Indicates the surface id. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_GetSurfaceId(image: *mut OH_NativeImage, surfaceId: *mut u64) -> i32; + /** @brief Set the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param listener Indicates the callback function. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_SetOnFrameAvailableListener( + image: *mut OH_NativeImage, + listener: OH_OnFrameAvailableListener, + ) -> i32; + /** @brief Unset the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_UnsetOnFrameAvailableListener(image: *mut OH_NativeImage) -> i32; +} diff --git a/src/native_image/api12_additions.rs b/src/native_image/api12_additions.rs new file mode 100644 index 0000000..c766d08 --- /dev/null +++ b/src/native_image/api12_additions.rs @@ -0,0 +1,18 @@ +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +use super::OH_NativeImage; + +extern "C" { + /** @brief Obtains the transform matrix of the texture image by producer transform type.\n + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param matrix Indicates the retrieved 4*4 transform matrix . + @return 0 - Success. + 40001000 - image is NULL. + @since 12 + @version 1.0*/ + pub fn OH_NativeImage_GetTransformMatrixV2(image: *mut OH_NativeImage, matrix: *mut f32) + -> i32; +} diff --git a/src/native_image/native_image_api10.rs b/src/native_image/native_image_api10.rs new file mode 100644 index 0000000..2f7eaeb --- /dev/null +++ b/src/native_image/native_image_api10.rs @@ -0,0 +1,84 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +use crate::native_window::OHNativeWindow; + +#[repr(C)] +pub struct OH_NativeImage { + _unused: [u8; 0], +} +extern "C" { + /** @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @param textureTarget Indicates the Opengl ES target. + @return Returns the pointer to the OH_NativeImage instance created if the operation is successful, \n + returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Create(textureId: u32, textureTarget: u32) -> *mut OH_NativeImage; + /** @brief Acquire the OHNativeWindow for the OH_NativeImage. This OHNativeWindow should be released by \n + OH_NativeWindow_DestroyNativeWindow when no longer needed. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the pointer to the OHNativeWindow if the operation is successful, returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AcquireNativeWindow(image: *mut OH_NativeImage) -> *mut OHNativeWindow; + /** @brief Attach the OH_NativeImage to Opengl ES context, and the Opengl ES texture is bound to the \n + GL_TEXTURE_EXTERNAL_OES, which will update by the OH_NativeImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AttachContext(image: *mut OH_NativeImage, textureId: u32) -> i32; + /** @brief Detach the OH_NativeImage from the Opengl ES context. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_DetachContext(image: *mut OH_NativeImage) -> i32; + /** @brief Update the related Opengl ES texture with the OH_NativeImage acquired buffer. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_UpdateSurfaceImage(image: *mut OH_NativeImage) -> i32; + /** @brief Get the timestamp of the texture image set by the most recent call to OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the timestamp associated to the texture image. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_GetTimestamp(image: *mut OH_NativeImage) -> i64; + /** @brief Return the transform matrix of the texture image set by the most recent call to \n + OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param matrix Indicates the retrieved 4*4 transform matrix . + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_GetTransformMatrix(image: *mut OH_NativeImage, matrix: *mut f32) -> i32; + /** @brief Destroy the OH_NativeImage created by OH_NativeImage_Create, and the pointer to \n + OH_NativeImage will be null after this operation. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage pointer. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Destroy(image: *mut *mut OH_NativeImage); +} diff --git a/src/native_image/native_image_api11.rs b/src/native_image/native_image_api11.rs new file mode 100644 index 0000000..92ef158 --- /dev/null +++ b/src/native_image/native_image_api11.rs @@ -0,0 +1,134 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +use crate::native_window::OHNativeWindow; + +#[repr(C)] +pub struct OH_NativeImage { + _unused: [u8; 0], +} +/** @brief The callback function of frame available. + +@syscap SystemCapability.Graphic.Graphic2D.NativeImage +@param context User defined context, returned to the user in the callback function +@since 11 +@version 1.0*/ +pub type OH_OnFrameAvailable = + ::core::option::Option; +/** @brief A listener for native image, use OH_NativeImage_SetOnFrameAvailableListener to register \n +the listener object to OH_NativeImage, the callback will be triggered when there is available frame + +@since 11 +@version 1.0*/ +#[repr(C)] +#[derive(Debug)] +pub struct OH_OnFrameAvailableListener { + /// User defined context, returned to the user in the callback function + pub context: *mut ::core::ffi::c_void, + /// The callback function of frame available. + pub onFrameAvailable: OH_OnFrameAvailable, +} +extern "C" { + /** @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @param textureTarget Indicates the Opengl ES target. + @return Returns the pointer to the OH_NativeImage instance created if the operation is successful, \n + returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Create(textureId: u32, textureTarget: u32) -> *mut OH_NativeImage; + /** @brief Acquire the OHNativeWindow for the OH_NativeImage. This OHNativeWindow should be released by \n + OH_NativeWindow_DestroyNativeWindow when no longer needed. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the pointer to the OHNativeWindow if the operation is successful, returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AcquireNativeWindow(image: *mut OH_NativeImage) -> *mut OHNativeWindow; + /** @brief Attach the OH_NativeImage to Opengl ES context, and the Opengl ES texture is bound to the \n + GL_TEXTURE_EXTERNAL_OES, which will update by the OH_NativeImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AttachContext(image: *mut OH_NativeImage, textureId: u32) -> i32; + /** @brief Detach the OH_NativeImage from the Opengl ES context. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_DetachContext(image: *mut OH_NativeImage) -> i32; + /** @brief Update the related Opengl ES texture with the OH_NativeImage acquired buffer. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_UpdateSurfaceImage(image: *mut OH_NativeImage) -> i32; + /** @brief Get the timestamp of the texture image set by the most recent call to OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the timestamp associated to the texture image. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_GetTimestamp(image: *mut OH_NativeImage) -> i64; + /** @brief Return the transform matrix of the texture image set by the most recent call to \n + OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param matrix Indicates the retrieved 4*4 transform matrix . + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_GetTransformMatrix(image: *mut OH_NativeImage, matrix: *mut f32) -> i32; + /** @brief Return the native image's surface id. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param surfaceId Indicates the surface id. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_GetSurfaceId(image: *mut OH_NativeImage, surfaceId: *mut u64) -> i32; + /** @brief Set the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param listener Indicates the callback function. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_SetOnFrameAvailableListener( + image: *mut OH_NativeImage, + listener: OH_OnFrameAvailableListener, + ) -> i32; + /** @brief Unset the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_UnsetOnFrameAvailableListener(image: *mut OH_NativeImage) -> i32; + /** @brief Destroy the OH_NativeImage created by OH_NativeImage_Create, and the pointer to \n + OH_NativeImage will be null after this operation. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage pointer. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Destroy(image: *mut *mut OH_NativeImage); +} diff --git a/src/native_image/native_image_api12.rs b/src/native_image/native_image_api12.rs new file mode 100644 index 0000000..186f1b4 --- /dev/null +++ b/src/native_image/native_image_api12.rs @@ -0,0 +1,146 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +use crate::native_window::OHNativeWindow; + +#[repr(C)] +pub struct OH_NativeImage { + _unused: [u8; 0], +} +/** @brief The callback function of frame available. + +@syscap SystemCapability.Graphic.Graphic2D.NativeImage +@param context User defined context, returned to the user in the callback function +@since 11 +@version 1.0*/ +pub type OH_OnFrameAvailable = + ::core::option::Option; +/** @brief A listener for native image, use OH_NativeImage_SetOnFrameAvailableListener to register \n +the listener object to OH_NativeImage, the callback will be triggered when there is available frame + +@since 11 +@version 1.0*/ +#[repr(C)] +#[derive(Debug)] +pub struct OH_OnFrameAvailableListener { + /// User defined context, returned to the user in the callback function + pub context: *mut ::core::ffi::c_void, + /// The callback function of frame available. + pub onFrameAvailable: OH_OnFrameAvailable, +} +extern "C" { + /** @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @param textureTarget Indicates the Opengl ES target. + @return Returns the pointer to the OH_NativeImage instance created if the operation is successful, \n + returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Create(textureId: u32, textureTarget: u32) -> *mut OH_NativeImage; + /** @brief Acquire the OHNativeWindow for the OH_NativeImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the pointer to the OHNativeWindow if the operation is successful, returns NULL otherwise. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AcquireNativeWindow(image: *mut OH_NativeImage) -> *mut OHNativeWindow; + /** @brief Attach the OH_NativeImage to Opengl ES context, and the Opengl ES texture is bound to the \n + GL_TEXTURE_EXTERNAL_OES, which will update by the OH_NativeImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param textureId Indicates the id of the Opengl ES texture which the native image attached to. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_AttachContext(image: *mut OH_NativeImage, textureId: u32) -> i32; + /** @brief Detach the OH_NativeImage from the Opengl ES context. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_DetachContext(image: *mut OH_NativeImage) -> i32; + /** @brief Update the related Opengl ES texture with the OH_NativeImage acquired buffer. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_UpdateSurfaceImage(image: *mut OH_NativeImage) -> i32; + /** @brief Get the timestamp of the texture image set by the most recent call to OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns the timestamp associated to the texture image. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_GetTimestamp(image: *mut OH_NativeImage) -> i64; + /** @brief Return the transform matrix of the texture image set by the most recent call to \n + OH_NativeImage_UpdateSurfaceImage. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param matrix Indicates the retrieved 4*4 transform matrix . + @return Returns an error code, 0 is success, otherwise, failed. + @since 9 + @version 1.0 + @deprecated since 12 + @useinstead OH_NativeImage_GetTransformMatrixV2*/ + pub fn OH_NativeImage_GetTransformMatrix(image: *mut OH_NativeImage, matrix: *mut f32) -> i32; + /** @brief Return the native image's surface id. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param surfaceId Indicates the surface id. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_GetSurfaceId(image: *mut OH_NativeImage, surfaceId: *mut u64) -> i32; + /** @brief Set the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param listener Indicates the callback function. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_SetOnFrameAvailableListener( + image: *mut OH_NativeImage, + listener: OH_OnFrameAvailableListener, + ) -> i32; + /** @brief Unset the frame available callback. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @return Returns an error code, 0 is success, otherwise, failed. + @since 11 + @version 1.0*/ + pub fn OH_NativeImage_UnsetOnFrameAvailableListener(image: *mut OH_NativeImage) -> i32; + /** @brief Destroy the OH_NativeImage created by OH_NativeImage_Create, and the pointer to \n + OH_NativeImage will be null after this operation. + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage pointer. + @since 9 + @version 1.0*/ + pub fn OH_NativeImage_Destroy(image: *mut *mut OH_NativeImage); + /** @brief Obtains the transform matrix of the texture image by producer transform type.\n + + @syscap SystemCapability.Graphic.Graphic2D.NativeImage + @param image Indicates the pointer to a OH_NativeImage instance. + @param matrix Indicates the retrieved 4*4 transform matrix . + @return 0 - Success. + 40001000 - image is NULL. + @since 12 + @version 1.0*/ + pub fn OH_NativeImage_GetTransformMatrixV2(image: *mut OH_NativeImage, matrix: *mut f32) + -> i32; +}