diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h
index 0099131f645a9479a037e28e42bcbe6c89133430..612b996f5908db2162c6a095fd2c56db216efe32 100644
--- a/graphic/graphic_2d/native_buffer/native_buffer.h
+++ b/graphic/graphic_2d/native_buffer/native_buffer.h
@@ -88,6 +88,80 @@ 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 11
+ * @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_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) */
+ 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_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) */
+ 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,
+ /** 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,
+};
+
/**
* @brief OH_NativeBuffer config. \n
* Used to allocating new OH_NativeBuffer andquery parameters if existing ones.
@@ -187,6 +261,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 11
+ * @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 ada8357cb904d7520411aacdf6374414f0517912..b344a332cc9e33aa21b19bcfebc898b2363433f9 100644
--- a/graphic/graphic_2d/native_image/native_image.h
+++ b/graphic/graphic_2d/native_image/native_image.h
@@ -46,6 +46,29 @@ 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;
/**
* @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n
@@ -132,6 +155,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 11
+ * @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 11
+ * @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 11
+ * @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 02dbbef3e38a959cb4c353b8eecbbeabda9e378b..b076a9106c2d32069659fcbf59fdde4e09c6c996 100644
--- a/graphic/graphic_2d/native_window/external_window.h
+++ b/graphic/graphic_2d/native_window/external_window.h
@@ -299,6 +299,18 @@ 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 11
+ * @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 +350,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 11
+ * @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.
*