From 350a8fdaffdcf9b784d385bf547769cce507050d Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 9 Nov 2023 16:47:39 +0800 Subject: [PATCH 01/13] add native interface Signed-off-by: lin-jianwu --- .../graphic_2d/native_buffer/native_buffer.h | 53 +++++++++++++++++++ .../graphic_2d/native_image/native_image.h | 41 ++++++++++++++ .../native_window/external_window.h | 23 ++++++++ 3 files changed, 117 insertions(+) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 0099131f6..434ffe3f9 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -88,6 +88,48 @@ enum OH_NativeBuffer_Format { NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF /// < Invalid pixel format */ }; +/** + * @brief Indicates the color space of a native buffer. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 10 + * @version 1.0 + */ +enum OH_NativeBuffer_ColorSpace { + OH_COLORSPACE_NONE, + OH_COLORSPACE_BT601_EBU_FULL, + OH_COLORSPACE_BT601_SMPLE_C_FULL, + OH_COLORSPACE_BT709_FULL, + OH_COLORSPACE_BT2020_HLG_FULL, + OH_COLORSPACE_BT2020_PQ_FULL, + OH_COLORSPACE_BT601_EBU_LIMIT, + OH_COLORSPACE_BT601_SMPLE_C_LIMIT, + OH_COLORSPACE_BT709_LIMIT, + OH_COLORSPACE_BT2020_HLG_LIMIT, + OH_COLORSPACE_BT2020_PQ_LIMIT, + OH_COLORSPACE_SRGB_FULL, + OH_COLORSPACE_P3_FULL, + OH_COLORSPACE_P3_HLG_FULL, + OH_COLORSPACE_P3_PQ_FULL, + OH_COLORSPACE_ADOBERGB_FULL, + OH_COLORSPACE_SRGB_LIMITED, + OH_COLORSPACE_P3_LIMITED, + OH_COLORSPACE_P3_HLG_LIMITED, + OH_COLORSPACE_P3_PQ_LIMITED, + OH_COLORSPACE_ADOBERGB_LIMITED, + OH_COLORSPACE_LINEAR_SRGB, + OH_COLORSPACE_LINEAR_BT709, + OH_COLORSPACE_LINEAR_P3, + OH_COLORSPACE_LINEAR_BT2020, + OH_COLORSPACE_DISPLAY_SRGB, + OH_COLORSPACE_DISPLAY_P3_SRGB, + OH_COLORSPACE_DISPLAY_P3_HLG, + OH_COLORSPACE_DISPLAY_P3_PQ, + OH_COLORSPACE_DISPLAY_BT2020_SRGB, + OH_COLORSPACE_DISPLAY_BT2020_HLG, + OH_COLORSPACE_DISPLAY_BT2020_PQ, +}; + /** * @brief OH_NativeBuffer config. \n * Used to allocating new OH_NativeBuffer andquery parameters if existing ones. @@ -187,6 +229,17 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); */ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); +/** + * @brief Set the color space of the OH_NativeBuffer. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @param buffer Indicates the pointer to a OH_NativeBuffer instance. + * @param colorSpace Indicates the color space of native buffer, see OH_NativeBuffer_ColorSpace. + * @return Returns the sequence number, which is unique for each OH_NativeBuffer. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index ada8357cb..e57bbbfec 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -46,6 +46,12 @@ extern "C" { struct OH_NativeImage; typedef struct OH_NativeImage OH_NativeImage; typedef struct NativeWindow OHNativeWindow; +typedef void (*OH_OnFrameAvailable)(void *context); +typedef struct OH_OnFrameAvailableListener +{ + void *context; + OH_OnFrameAvailable onFrameAvailable; +} OH_OnFrameAvailableListener; /** * @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n @@ -132,6 +138,41 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); */ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); +/** + * @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 10 + * @version 1.0 + */ +int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); + +/** + * @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 10 + * @version 1.0 + */ +int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener); + +/** + * @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 10 + * @version 1.0 + */ +int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); + /** * @brief Destroy the OH_NativeImage created by OH_NativeImage_Create, and the pointer to \n * OH_NativeImage will be null after this operation. diff --git a/graphic/graphic_2d/native_window/external_window.h b/graphic/graphic_2d/native_window/external_window.h index 02dbbef3e..d83b58239 100644 --- a/graphic/graphic_2d/native_window/external_window.h +++ b/graphic/graphic_2d/native_window/external_window.h @@ -299,6 +299,17 @@ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); +/** + * @brief Creates a OHNativeWindowBuffer instance. A new OHNativeWindowBuffer instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param nativeBuffer Indicates the pointer to a native buffer. The type is OH_NativeBuffer*. + * @return Returns the pointer to the OHNativeWindowBuffer instance created. + * @since 10 + * @version 1.0 + */ +OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer); + /** * @brief Decreases the reference count of a OHNativeWindowBuffer instance by 1 and, when the reference count reaches 0, destroys the instance. * @@ -338,6 +349,18 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window, int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer, int fenceFd, Region region); +/** + * @brief Get the last flushed OHNativeWindowBuffer from a OHNativeWindow instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Indicates the pointer to a OHNativeWindow instance. + * @param buffer Indicates the pointer to a OHNativeWindowBuffer instance. + * @return Returns an error code, 0 is success, otherwise, failed. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + /** * @brief Returns the OHNativeWindowBuffer to the buffer queue through a OHNativeWindow instance, without filling in any content. The OHNativeWindowBuffer can be used for another request. * -- Gitee From 2dd4c305de094f2556d89204164a9336ed8adacf Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 9 Nov 2023 17:07:28 +0800 Subject: [PATCH 02/13] add native interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_buffer/native_buffer.h | 6 +++--- graphic/graphic_2d/native_image/native_image.h | 6 +++--- graphic/graphic_2d/native_window/external_window.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 434ffe3f9..6e03122df 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -63,7 +63,7 @@ enum OH_NativeBuffer_Usage { * @brief Indicates the format of a native buffer. * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer - * @since 10 + * @since 11 * @version 1.0 */ enum OH_NativeBuffer_Format { @@ -92,7 +92,7 @@ enum OH_NativeBuffer_Format { * @brief Indicates the color space of a native buffer. * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer - * @since 10 + * @since 11 * @version 1.0 */ enum OH_NativeBuffer_ColorSpace { @@ -236,7 +236,7 @@ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); * @param buffer Indicates the pointer to a OH_NativeBuffer instance. * @param colorSpace Indicates the color space of native buffer, see OH_NativeBuffer_ColorSpace. * @return Returns the sequence number, which is unique for each OH_NativeBuffer. - * @since 10 + * @since 11 * @version 1.0 */ int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace); diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index e57bbbfec..c08baf12b 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -145,7 +145,7 @@ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16 * @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 10 + * @since 11 * @version 1.0 */ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); @@ -157,7 +157,7 @@ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); * @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 10 + * @since 11 * @version 1.0 */ int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener); @@ -168,7 +168,7 @@ int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnF * @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 10 + * @since 11 * @version 1.0 */ int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); diff --git a/graphic/graphic_2d/native_window/external_window.h b/graphic/graphic_2d/native_window/external_window.h index d83b58239..22524c73c 100644 --- a/graphic/graphic_2d/native_window/external_window.h +++ b/graphic/graphic_2d/native_window/external_window.h @@ -305,7 +305,7 @@ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer( * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param nativeBuffer Indicates the pointer to a native buffer. The type is OH_NativeBuffer*. * @return Returns the pointer to the OHNativeWindowBuffer instance created. - * @since 10 + * @since 11 * @version 1.0 */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer); @@ -356,7 +356,7 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative * @param window Indicates the pointer to a OHNativeWindow instance. * @param buffer Indicates the pointer to a OHNativeWindowBuffer instance. * @return Returns an error code, 0 is success, otherwise, failed. - * @since 10 + * @since 11 * @version 1.0 */ int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); -- Gitee From 522c14670ac2c6b84c3c1df863392704123cdd55 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 9 Nov 2023 17:08:52 +0800 Subject: [PATCH 03/13] add native interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_buffer/native_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 6e03122df..5bf8afc18 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -63,7 +63,7 @@ enum OH_NativeBuffer_Usage { * @brief Indicates the format of a native buffer. * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer - * @since 11 + * @since 10 * @version 1.0 */ enum OH_NativeBuffer_Format { -- Gitee From c2b6621d0f143e51f71c174a367ea0ef6030145c Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 9 Nov 2023 20:58:15 +0800 Subject: [PATCH 04/13] add native interface Signed-off-by: lin-jianwu --- .../graphic_2d/native_buffer/native_buffer.h | 42 ++++++++++++++++--- .../graphic_2d/native_image/native_image.h | 18 ++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 5bf8afc18..5bf410f68 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -96,37 +96,69 @@ enum OH_NativeBuffer_Format { * @version 1.0 */ enum OH_NativeBuffer_ColorSpace { + /** None color space */ OH_COLORSPACE_NONE, + /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT601_EBU_FULL, + /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21)*/ OH_COLORSPACE_BT601_SMPLE_C_FULL, + /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT709_FULL, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT2020_HLG_FULL, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT2020_PQ_FULL, + /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT601_EBU_LIMIT, + /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT601_SMPLE_C_LIMIT, + /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT709_LIMIT, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT2020_HLG_LIMIT, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT2020_PQ_LIMIT, + /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_SRGB_FULL, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_P3_FULL, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_P3_HLG_FULL, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_P3_PQ_FULL, + /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_ADOBERGB_FULL, - OH_COLORSPACE_SRGB_LIMITED, - OH_COLORSPACE_P3_LIMITED, - OH_COLORSPACE_P3_HLG_LIMITED, - OH_COLORSPACE_P3_PQ_LIMITED, - OH_COLORSPACE_ADOBERGB_LIMITED, + /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */ + OH_COLORSPACE_SRGB_LIMIT, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ + OH_COLORSPACE_P3_LIMIT, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ + OH_COLORSPACE_P3_HLG_LIMIT, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ + OH_COLORSPACE_P3_PQ_LIMIT, + /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_LIMITED << 21) */ + OH_COLORSPACE_ADOBERGB_LIMIT, + /** COLORPRIMARIES_SRGB | (TRANSFUNC_LINEAR << 8) */ OH_COLORSPACE_LINEAR_SRGB, + /** equal to OH_COLORSPACE_LINEAR_SRGB */ OH_COLORSPACE_LINEAR_BT709, + /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_LINEAR << 8) */ OH_COLORSPACE_LINEAR_P3, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_LINEAR << 8) */ OH_COLORSPACE_LINEAR_BT2020, + /** equal to OH_COLORSPACE_SRGB_FULL */ OH_COLORSPACE_DISPLAY_SRGB, + /** equal to OH_COLORSPACE_P3_FULL */ OH_COLORSPACE_DISPLAY_P3_SRGB, + /** equal to OH_COLORSPACE_P3_HLG_FULL */ OH_COLORSPACE_DISPLAY_P3_HLG, + /** equal to OH_COLORSPACE_P3_PQ_FULL */ OH_COLORSPACE_DISPLAY_P3_PQ, + /** COLORPRIMARIES_BT2020 | (TRANSFUNC_SRGB << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_DISPLAY_BT2020_SRGB, + /** equal to OH_COLORSPACE_BT2020_HLG_FULL */ OH_COLORSPACE_DISPLAY_BT2020_HLG, + /** equal to OH_COLORSPACE_BT2020_PQ_FULL */ OH_COLORSPACE_DISPLAY_BT2020_PQ, }; diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index c08baf12b..d020fb2d1 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -46,10 +46,28 @@ extern "C" { struct OH_NativeImage; typedef struct OH_NativeImage OH_NativeImage; typedef struct NativeWindow OHNativeWindow; +/** + * @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 + */ typedef void (*OH_OnFrameAvailable)(void *context); + +/** + * @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 + */ typedef struct OH_OnFrameAvailableListener { + /** User defined context, returned to the user in the callback function*/ void *context; + /** The callback function of frame available.*/ OH_OnFrameAvailable onFrameAvailable; } OH_OnFrameAvailableListener; -- Gitee From f4c864478b535de4c975ac4b413e741e6b200841 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Fri, 10 Nov 2023 15:22:02 +0800 Subject: [PATCH 05/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_buffer/native_buffer.h | 2 +- graphic/graphic_2d/native_image/native_image.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 5bf410f68..c059eeb33 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -267,7 +267,7 @@ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Indicates the pointer to a OH_NativeBuffer instance. * @param colorSpace Indicates the color space of native buffer, see OH_NativeBuffer_ColorSpace. - * @return Returns the sequence number, which is unique for each OH_NativeBuffer. + * @return Returns an error code, 0 is success, otherwise, failed. * @since 11 * @version 1.0 */ diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index d020fb2d1..6e95ee635 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -57,7 +57,7 @@ typedef struct NativeWindow OHNativeWindow; typedef void (*OH_OnFrameAvailable)(void *context); /** - * @brief A listener for native image, use OH_NativeImage_SetOnFrameAvailableListener to register \n + * @brief A listener for OH_NativeImage, 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 @@ -65,9 +65,9 @@ typedef void (*OH_OnFrameAvailable)(void *context); */ typedef struct OH_OnFrameAvailableListener { - /** User defined context, returned to the user in the callback function*/ + /** User defined context, returned to the user in the callback function. */ void *context; - /** The callback function of frame available.*/ + /** The callback function of frame available. */ OH_OnFrameAvailable onFrameAvailable; } OH_OnFrameAvailableListener; -- Gitee From e5b18941061174e88f41ecb000015712cd7a4677 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Sun, 12 Nov 2023 18:52:49 +0800 Subject: [PATCH 06/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_image/native_image.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 6e95ee635..9cece6542 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -144,7 +144,7 @@ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); /** - * @brief Return the transform matrix of the texture image set by the most recent call to \n + * @brief Obtains the transform matrix of the texture image set by the most recent call to \n * OH_NativeImage_UpdateSurfaceImage. * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage @@ -157,7 +157,7 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); /** - * @brief Return the native image's surface id. + * @brief Obtains the native image's surface id. * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Indicates the pointer to a OH_NativeImage instance. @@ -173,7 +173,7 @@ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Indicates the pointer to a OH_NativeImage instance. - * @param listener Indicates the callback function. + * @param listener Indicates the callback listener. * @return Returns an error code, 0 is success, otherwise, failed. * @since 11 * @version 1.0 -- Gitee From 0754de1174abf267828c864a583c80ab39a29f20 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Tue, 14 Nov 2023 14:41:03 +0800 Subject: [PATCH 07/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_image/native_image.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 9cece6542..05a420cbc 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -63,8 +63,7 @@ typedef void (*OH_OnFrameAvailable)(void *context); * @since 11 * @version 1.0 */ -typedef struct OH_OnFrameAvailableListener -{ +typedef struct OH_OnFrameAvailableListener { /** User defined context, returned to the user in the callback function. */ void *context; /** The callback function of frame available. */ -- Gitee From dc58e762825d9cff4c41102020ed9dff5cf3ff41 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Tue, 14 Nov 2023 19:46:16 +0800 Subject: [PATCH 08/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_buffer/native_buffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index c059eeb33..4c8f1971e 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -101,7 +101,7 @@ enum OH_NativeBuffer_ColorSpace { /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT601_EBU_FULL, /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21)*/ - OH_COLORSPACE_BT601_SMPLE_C_FULL, + OH_COLORSPACE_BT601_SMPTE_C_FULL, /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_FULL << 21) */ OH_COLORSPACE_BT709_FULL, /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ @@ -111,7 +111,7 @@ enum OH_NativeBuffer_ColorSpace { /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT601_EBU_LIMIT, /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */ - OH_COLORSPACE_BT601_SMPLE_C_LIMIT, + OH_COLORSPACE_BT601_SMPTE_C_LIMIT, /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_LIMITED << 21) */ OH_COLORSPACE_BT709_LIMIT, /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */ -- Gitee From 84abe47bfc2979557e07d1bfaab66353bc56905d Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Wed, 15 Nov 2023 19:05:33 +0800 Subject: [PATCH 09/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_image/native_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 05a420cbc..9b4d44889 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -143,7 +143,7 @@ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); /** - * @brief Obtains the transform matrix of the texture image set by the most recent call to \n + * @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 -- Gitee From 481bc997049210c34901a7e8086578e3afaa1174 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 16 Nov 2023 16:53:13 +0800 Subject: [PATCH 10/13] add capi interface Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_window/external_window.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_window/external_window.h b/graphic/graphic_2d/native_window/external_window.h index 22524c73c..b076a9106 100644 --- a/graphic/graphic_2d/native_window/external_window.h +++ b/graphic/graphic_2d/native_window/external_window.h @@ -300,7 +300,8 @@ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); /** - * @brief Creates a OHNativeWindowBuffer instance. A new OHNativeWindowBuffer instance is created each time this function is called. + * @brief Creates a OHNativeWindowBuffer instance. + A new OHNativeWindowBuffer instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param nativeBuffer Indicates the pointer to a native buffer. The type is OH_NativeBuffer*. -- Gitee From 3d119436aab0acdef03d9aa9135e31a29766348d Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Fri, 17 Nov 2023 10:45:26 +0800 Subject: [PATCH 11/13] add graphic capi comment Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_image/native_image.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 9b4d44889..c30ae5614 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -64,9 +64,9 @@ typedef void (*OH_OnFrameAvailable)(void *context); * @version 1.0 */ typedef struct OH_OnFrameAvailableListener { - /** User defined context, returned to the user in the callback function. */ + /** User defined context, returned to the user in the callback function.*/ void *context; - /** The callback function of frame available. */ + /** The callback function of frame available.*/ OH_OnFrameAvailable onFrameAvailable; } OH_OnFrameAvailableListener; @@ -156,7 +156,7 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); /** - * @brief Obtains the native image's surface id. + * @brief Return the native image's surface id. * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Indicates the pointer to a OH_NativeImage instance. @@ -172,7 +172,7 @@ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Indicates the pointer to a OH_NativeImage instance. - * @param listener Indicates the callback listener. + * @param listener Indicates the callback function. * @return Returns an error code, 0 is success, otherwise, failed. * @since 11 * @version 1.0 -- Gitee From b0f0dd28a588f15f7bba9d4cfcec9519a47ab931 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Fri, 17 Nov 2023 12:19:50 +0800 Subject: [PATCH 12/13] add graphic capi comment Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_image/native_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index c30ae5614..336909cf1 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -64,7 +64,7 @@ typedef void (*OH_OnFrameAvailable)(void *context); * @version 1.0 */ typedef struct OH_OnFrameAvailableListener { - /** User defined context, returned to the user in the callback function.*/ + /** User defined context, returned to the user in the callback function*/ void *context; /** The callback function of frame available.*/ OH_OnFrameAvailable onFrameAvailable; -- Gitee From ca988125edabbf49af3a6b71dd1eb31dc15aaf39 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Fri, 17 Nov 2023 12:34:38 +0800 Subject: [PATCH 13/13] add graphic capi comment Signed-off-by: lin-jianwu --- graphic/graphic_2d/native_buffer/native_buffer.h | 2 +- graphic/graphic_2d/native_image/native_image.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 4c8f1971e..612b996f5 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -267,7 +267,7 @@ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Indicates the pointer to a OH_NativeBuffer instance. * @param colorSpace Indicates the color space of native buffer, see OH_NativeBuffer_ColorSpace. - * @return Returns an error code, 0 is success, otherwise, failed. + * @return Returns the sequence number, which is unique for each OH_NativeBuffer. * @since 11 * @version 1.0 */ diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 336909cf1..b344a332c 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -57,7 +57,7 @@ typedef struct NativeWindow OHNativeWindow; typedef void (*OH_OnFrameAvailable)(void *context); /** - * @brief A listener for OH_NativeImage, use OH_NativeImage_SetOnFrameAvailableListener to register \n + * @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 -- Gitee