!885 新增nativeBuffer和nativeWindow 色彩空间和元数据配置接口

Merge pull request !885 from xuedong/master
This commit is contained in:
openharmony_ci 2024-06-18 08:51:21 +00:00 committed by Gitee
commit e0df14a04d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 387 additions and 88 deletions

View File

@ -17,6 +17,7 @@ import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_buffer_header") {
dest_dir = "$ndk_headers_out_dir/native_buffer"
sources = [
"//interface/sdk_c/graphic/graphic_2d/native_buffer/buffer_common.h",
"//interface/sdk_c/graphic/graphic_2d/native_buffer/native_buffer.h",
"//interface/sdk_c/graphic/graphic_2d/native_window/graphic_error_code.h",
]

View File

@ -0,0 +1,227 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NDK_INCLUDE_BUFFER_COMMON_H_
#define NDK_INCLUDE_BUFFER_COMMON_H_
/**
* @addtogroup OH_NativeBuffer
* @{
*
* @brief Provides the common types for native buffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
/**
* @file native_buffer.h
*
* @brief Defines the common types for native buffer.
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @library libnative_buffer.so
* @since 12
* @version 1.0
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Indicates the color space of a native buffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 11
* @version 1.0
*/
/**
* @brief Indicates the color space of a native buffer.
* Move from native_buffer.h to native_common.h
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef 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,
} OH_NativeBuffer_ColorSpace;
/**
* @brief Indicates the HDR metadata type of a native buffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef enum OH_NativeBuffer_MetadataType {
/** HLG */
OH_VIDEO_HDR_HLG,
/** HDR10 */
OH_VIDEO_HDR_HDR10,
/** HDR VIVID */
OH_VIDEO_HDR_VIVID
} OH_NativeBuffer_MetadataType;
/**
* @brief Indicates the color x and y.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef struct OH_NativeBuffer_ColorXY {
/** color X */
float x;
/** color Y */
float y;
} OH_NativeBuffer_ColorXY;
/**
* @brief Indicates the smpte2086 metadata.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef struct OH_NativeBuffer_Smpte2086 {
/** primary red */
OH_NativeBuffer_ColorXY displayPrimaryRed;
/** primary green */
OH_NativeBuffer_ColorXY displayPrimaryGreen;
/** primary blue */
OH_NativeBuffer_ColorXY displayPrimaryBlue;
/** white point */
OH_NativeBuffer_ColorXY whitePoint;
/** max luminance */
float maxLuminance;
/** min luminance */
float minLuminance;
} OH_NativeBuffer_Smpte2086;
/**
* @brief Indicates the cta861.3 metadata.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef struct OH_NativeBuffer_Cta861 {
/** max content lightLevel */
float maxContentLightLevel;
/** max frame average light level */
float maxFrameAverageLightLevel;
} OH_NativeBuffer_Cta861;
/**
* @brief Indicates the HDR static metadata.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef struct OH_NativeBuffer_StaticMetadata {
/** smpte 2086 metadata*/
OH_NativeBuffer_Smpte2086 smpte2086;
/** CTA-861.3 metadata*/
OH_NativeBuffer_Cta861 cta861;
} OH_NativeBuffer_StaticMetadata;
/**
* @brief Indicates the HDR metadata key of a native buffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 12
* @version 1.0
*/
typedef enum OH_NativeBuffer_MetadataKey {
/** value: OH_NativeBuffer_MetadataType*/
OH_HDR_METADATA_TYPE,
/** value: OH_NativeBuffer_StaticMetadata*/
OH_HDR_STATIC_METADATA,
/** byte stream of SEI in video stream*/
OH_HDR_DYNAMIC_METADATA
} OH_NativeBuffer_MetadataKey;
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@ -8,5 +8,17 @@
{ "name": "OH_NativeBuffer_GetSeqNum" },
{ "name": "OH_NativeBuffer_SetColorSpace" },
{ "name": "OH_NativeBuffer_MapPlanes" },
{ "name": "OH_NativeBuffer_FromNativeWindowBuffer" }
{ "name": "OH_NativeBuffer_FromNativeWindowBuffer" },
{
"first_introduced": "12",
"name": "OH_NativeBuffer_GetColorSpace"
},
{
"first_introduced": "12",
"name": "OH_NativeBuffer_SetMetadataValue"
},
{
"first_introduced": "12",
"name": "OH_NativeBuffer_GetMetadataValue"
}
]

View File

@ -39,6 +39,7 @@
#include <stdint.h>
#include <native_window/external_window.h>
#include <native_buffer/buffer_common.h>
#ifdef __cplusplus
extern "C" {
@ -198,80 +199,6 @@ typedef enum OH_NativeBuffer_Format {
NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF /// < Invalid pixel format */
} OH_NativeBuffer_Format;
/**
* @brief Indicates the color space of a native buffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 11
* @version 1.0
*/
typedef 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,
} OH_NativeBuffer_ColorSpace;
/**
* @brief Indicates the transform type of a native buffer.
*
@ -439,18 +366,6 @@ 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 <b>OH_NativeBuffer</b> instance.
* @param colorSpace Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>.
* @return Returns an error code, 0 is success, otherwise, failed.
* @since 11
* @version 1.0
*/
int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace);
/**
* @brief Provide direct cpu access to the potentially multi-plannar OH_NativeBuffer in the process's address space.
*
@ -475,6 +390,69 @@ int32_t OH_NativeBuffer_MapPlanes(OH_NativeBuffer *buffer, void **virAddr, OH_Na
* @version 1.0
*/
int32_t OH_NativeBuffer_FromNativeWindowBuffer(OHNativeWindowBuffer *nativeWindowBuffer, OH_NativeBuffer **buffer);
/**
* @brief Set the color space of the OH_NativeBuffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
* @param colorSpace Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>.
* @return Returns an error code, 0 is success, otherwise, failed.
* @since 11
* @version 1.0
*/
int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace);
/**
* @brief Get the color space of the OH_NativeBuffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
* @param colorSpace Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state.
* @since 12
* @version 1.0
*/
int32_t OH_NativeBuffer_GetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace *colorSpace);
/**
* @brief Set the metadata type of the OH_NativeBuffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
* @param metadataKey Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>.
* @param size Indicates the size of a uint8_t vector.
* @param metadata Indicates the pointer to a uint8_t vector.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer or metadata is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.
* {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.
* @since 12
* @version 1.0
*/
int32_t OH_NativeBuffer_SetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey,
int32_t size, uint8_t *metadata);
/**
* @brief Set the metadata type of the OH_NativeBuffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance.
* @param metadataKey Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>.
* @param size Indicates the size of a uint8_t vector.
* @param metadata Indicates the pointer to a uint8_t vector.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer, metadata, or size is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.
* {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.
* @since 12
* @version 1.0
*/
int32_t OH_NativeBuffer_GetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey,
int32_t *size, uint8_t **metadata);
#ifdef __cplusplus
}
#endif

View File

@ -39,6 +39,7 @@
#include <stdint.h>
#include "buffer_handle.h"
#include "../native_buffer/buffer_common.h"
#ifdef __cplusplus
extern "C" {
@ -721,9 +722,72 @@ int32_t OH_NativeWindow_ReadFromParcel(OHIPCParcel *parcel, OHNativeWindow **win
* @since 12
* @version 1.0
*/
int32_t OH_NativeWindow_GetLastFlushedBufferV2(OHNativeWindow *window, OHNativeWindowBuffer **buffer,
int *fenceFd, float matrix[16]);
/**
* @brief Set the color space of the native window.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
* @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
* @param colorSpace Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state.
* @since 12
* @version 1.0
*/
int32_t OH_NativeWindow_SetColorSpace(OHNativeWindow *window, OH_NativeBuffer_ColorSpace colorSpace);
/**
* @brief Get the color space of the native window.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
* @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
* @param colorSpace Indicates the color space of native window, see <b>OH_NativeBuffer_ColorSpace</b>.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state.
* @since 12
* @version 1.0
*/
int32_t OH_NativeWindow_GetColorSpace(OHNativeWindow *window, OH_NativeBuffer_ColorSpace *colorSpace);
/**
* @brief Set the metadata type of the native window.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
* @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
* @param metadataKey Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
* @param size Indicates the size of a uint8_t vector.
* @param metadata Indicates the pointer to a uint8_t vector.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window or metadata is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.
* {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.
* @since 12
* @version 1.0
*/
int32_t OH_NativeWindow_SetMetadataValue(OHNativeWindow *window, OH_NativeBuffer_MetadataKey metadataKey,
int32_t size, uint8_t *metadata);
/**
* @brief Set the metadata type of the native window.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
* @param window Indicates the pointer to a <b>OHNativeWindow</b> instance.
* @param metadataKey Indicates the metadata type of native window, see <b>OH_NativeBuffer_MetadataKey</b>.
* @param size Indicates the size of a uint8_t vector.
* @param metadata Indicates the pointer to a uint8_t vector.
* @return {@link NATIVE_ERROR_OK} 0 - Success.
* {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window, metadata, or size is NULL.
* {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state.
* {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key.
* @since 12
* @version 1.0
*/
int32_t OH_NativeWindow_GetMetadataValue(OHNativeWindow *window, OH_NativeBuffer_MetadataKey metadataKey,
int32_t *size, uint8_t **metadata);
#ifdef __cplusplus
}
#endif

View File

@ -34,5 +34,22 @@
"first_introduced": "12",
"name": "OH_NativeWindow_ReadFromParcel"
},
{ "name": "OH_NativeWindow_GetLastFlushedBufferV2" }
{ "name": "OH_NativeWindow_GetLastFlushedBufferV2" },
{
"first_introduced": "12",
"name": "OH_NativeWindow_SetColorSpace"
},
{
"first_introduced": "12",
"name": "OH_NativeWindow_GetColorSpace"
},
{
"first_introduced": "12",
"name": "OH_NativeWindow_SetMetadataValue"
},
{
"first_introduced": "12",
"name": "OH_NativeWindow_GetMetadataValue"
}
]