diff --git a/graphic/graphic_2d/native_image/libnative_image.ndk.json b/graphic/graphic_2d/native_image/libnative_image.ndk.json index 1a8c6688deed4d6b3103e20d66bb88dafaee707b..1b40db3aafe575c466ec47ad9d4c2a83a71e8e2d 100644 --- a/graphic/graphic_2d/native_image/libnative_image.ndk.json +++ b/graphic/graphic_2d/native_image/libnative_image.ndk.json @@ -11,6 +11,10 @@ { "name": "OH_NativeImage_UnsetOnFrameAvailableListener" }, { "name": "OH_NativeImage_Destroy" }, { "name": "OH_NativeImage_GetTransformMatrixV2" }, + { + "first_introduced": "15", + "name": "OH_NativeImage_GetBufferMatrix" + }, { "first_introduced": "12", "name": "OH_NativeImage_AcquireNativeWindowBuffer" diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 38702c9e1c5f1ca103dc5d434c15c6f63f145ccf..9ad3ebbd74ba203e5e19e9c5f94acb83c1ddcbca 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -239,6 +239,24 @@ void OH_NativeImage_Destroy(OH_NativeImage** image); */ int32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[16]); +/** + * @brief Obtains the transform matrix that combines with crop rect. + * + * This API returns a transform matrix that combines the crop rect. + * Note that the matrix will not be updated until OH_NativeImage_UpdateSurfaceImage is called.\n + * This interface is a non-thread-safe type interface.\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 {@link NATIVE_ERROR_OK} 0 - Success. + * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image is NULL. + * {@link NATIVE_ERROR_MEM_OPERATION_ERROR} 30001000 - Memory operation error, failed to get transform matrix. + * @since 15 + * @version 1.0 + */ +int32_t OH_NativeImage_GetBufferMatrix(OH_NativeImage* image, float matrix[16]); + /** * @brief Acquire an OHNativeWindowBuffer through an OH_NativeImage instance for content consumer.\n * This method can not be used at the same time with OH_NativeImage_UpdateSurfaceImage.\n diff --git a/graphic/graphic_2d/native_window/graphic_error_code.h b/graphic/graphic_2d/native_window/graphic_error_code.h index 1c16d7b95f1dcfb94a261dcb4f059e3264c744fd..fe1df86f5c29ca60c4afae5d6b519a95e7124115 100644 --- a/graphic/graphic_2d/native_window/graphic_error_code.h +++ b/graphic/graphic_2d/native_window/graphic_error_code.h @@ -52,6 +52,11 @@ extern "C" { typedef enum OHNativeErrorCode { /** @error succeed */ NATIVE_ERROR_OK = 0, + /** + * @error memory operation error + * @since 15 + */ + NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000, /** @error input invalid parameter */ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000, /** @error unauthorized operation */