132a6e48fSopenharmony_ci/* 232a6e48fSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 332a6e48fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 432a6e48fSopenharmony_ci * you may not use this file except in compliance with the License. 532a6e48fSopenharmony_ci * You may obtain a copy of the License at 632a6e48fSopenharmony_ci * 732a6e48fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 832a6e48fSopenharmony_ci * 932a6e48fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1032a6e48fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1132a6e48fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1232a6e48fSopenharmony_ci * See the License for the specific language governing permissions and 1332a6e48fSopenharmony_ci * limitations under the License. 1432a6e48fSopenharmony_ci */ 1532a6e48fSopenharmony_ci 1632a6e48fSopenharmony_ci#ifndef NDK_INCLUDE_NATIVE_BUFFER_H_ 1732a6e48fSopenharmony_ci#define NDK_INCLUDE_NATIVE_BUFFER_H_ 1832a6e48fSopenharmony_ci 1932a6e48fSopenharmony_ci/** 2032a6e48fSopenharmony_ci * @addtogroup OH_NativeBuffer 2132a6e48fSopenharmony_ci * @{ 2232a6e48fSopenharmony_ci * 2332a6e48fSopenharmony_ci * @brief Provides the native buffer capability. 2432a6e48fSopenharmony_ci * 2532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 2632a6e48fSopenharmony_ci * @since 9 2732a6e48fSopenharmony_ci * @version 1.0 2832a6e48fSopenharmony_ci */ 2932a6e48fSopenharmony_ci 3032a6e48fSopenharmony_ci/** 3132a6e48fSopenharmony_ci * @file native_buffer.h 3232a6e48fSopenharmony_ci * 3332a6e48fSopenharmony_ci * @brief Defines the functions for obtaining and using a native buffer. 3432a6e48fSopenharmony_ci * 3532a6e48fSopenharmony_ci * @library libnative_buffer.so 3632a6e48fSopenharmony_ci * @since 9 3732a6e48fSopenharmony_ci * @version 1.0 3832a6e48fSopenharmony_ci */ 3932a6e48fSopenharmony_ci 4032a6e48fSopenharmony_ci#include <stdint.h> 4132a6e48fSopenharmony_ci 4232a6e48fSopenharmony_ci#ifdef __cplusplus 4332a6e48fSopenharmony_ciextern "C" { 4432a6e48fSopenharmony_ci#endif 4532a6e48fSopenharmony_ci 4632a6e48fSopenharmony_cistruct OH_NativeBuffer; 4732a6e48fSopenharmony_citypedef struct OH_NativeBuffer OH_NativeBuffer; 4832a6e48fSopenharmony_citypedef struct NativeWindowBuffer OHNativeWindowBuffer; 4932a6e48fSopenharmony_ci 5032a6e48fSopenharmony_ci/** 5132a6e48fSopenharmony_ci * @brief Indicates the usage of a native buffer. 5232a6e48fSopenharmony_ci * 5332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 5432a6e48fSopenharmony_ci * @since 10 5532a6e48fSopenharmony_ci * @version 1.0 5632a6e48fSopenharmony_ci */ 5732a6e48fSopenharmony_citypedef enum OH_NativeBuffer_Usage { 5832a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0), /// < CPU read buffer */ 5932a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1), /// < CPU write memory */ 6032a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3), /// < Direct memory access (DMA) buffer */ 6132a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_HW_RENDER = (1ULL << 8), /// < For GPU write case */ 6232a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_HW_TEXTURE = (1ULL << 9), /// < For GPU read case */ 6332a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_CPU_READ_OFTEN = (1ULL << 16), /// < Often be mapped for direct CPU reads */ 6432a6e48fSopenharmony_ci NATIVEBUFFER_USAGE_ALIGNMENT_512 = (1ULL << 18), /// < 512 bytes alignment */ 6532a6e48fSopenharmony_ci} OH_NativeBuffer_Usage; 6632a6e48fSopenharmony_ci 6732a6e48fSopenharmony_ci/** 6832a6e48fSopenharmony_ci * @brief Indicates the format of a native buffer. 6932a6e48fSopenharmony_ci * 7032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 7132a6e48fSopenharmony_ci * @since 10 7232a6e48fSopenharmony_ci * @version 1.0 7332a6e48fSopenharmony_ci */ 7432a6e48fSopenharmony_citypedef enum OH_NativeBuffer_Format { 7532a6e48fSopenharmony_ci /** 7632a6e48fSopenharmony_ci * CLUT8 format 7732a6e48fSopenharmony_ci * @since 12 7832a6e48fSopenharmony_ci */ 7932a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_CLUT8 = 0, 8032a6e48fSopenharmony_ci /** 8132a6e48fSopenharmony_ci * CLUT1 format 8232a6e48fSopenharmony_ci * @since 12 8332a6e48fSopenharmony_ci */ 8432a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_CLUT1, 8532a6e48fSopenharmony_ci /** 8632a6e48fSopenharmony_ci * CLUT4 format 8732a6e48fSopenharmony_ci * @since 12 8832a6e48fSopenharmony_ci */ 8932a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_CLUT4, 9032a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3, /// < RGB565 format */ 9132a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBA_5658, /// < RGBA5658 format */ 9232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBX_4444, /// < RGBX4444 format */ 9332a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBA_4444, /// < RGBA4444 format */ 9432a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGB_444, /// < RGB444 format */ 9532a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBX_5551, /// < RGBX5551 format */ 9632a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBA_5551, /// < RGBA5551 format */ 9732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGB_555, /// < RGB555 format */ 9832a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBX_8888, /// < RGBX8888 format */ 9932a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBA_8888, /// < RGBA8888 format */ 10032a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGB_888, /// < RGB888 format */ 10132a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGR_565, /// < BGR565 format */ 10232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRX_4444, /// < BGRX4444 format */ 10332a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRA_4444, /// < BGRA4444 format */ 10432a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRX_5551, /// < BGRX5551 format */ 10532a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRA_5551, /// < BGRA5551 format */ 10632a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRX_8888, /// < BGRX8888 format */ 10732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BGRA_8888, /// < BGRA8888 format */ 10832a6e48fSopenharmony_ci /** 10932a6e48fSopenharmony_ci * YUV422 interleaved format 11032a6e48fSopenharmony_ci * @since 12 11132a6e48fSopenharmony_ci */ 11232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YUV_422_I, 11332a6e48fSopenharmony_ci /** 11432a6e48fSopenharmony_ci * YCBCR422 semi-plannar format 11532a6e48fSopenharmony_ci * @since 12 11632a6e48fSopenharmony_ci */ 11732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP, 11832a6e48fSopenharmony_ci /** 11932a6e48fSopenharmony_ci * YCRCB422 semi-plannar format 12032a6e48fSopenharmony_ci * @since 12 12132a6e48fSopenharmony_ci */ 12232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCRCB_422_SP, 12332a6e48fSopenharmony_ci /** 12432a6e48fSopenharmony_ci * YCBCR420 semi-plannar format 12532a6e48fSopenharmony_ci * @since 12 12632a6e48fSopenharmony_ci */ 12732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP, 12832a6e48fSopenharmony_ci /** 12932a6e48fSopenharmony_ci * YCRCB420 semi-plannar format 13032a6e48fSopenharmony_ci * @since 12 13132a6e48fSopenharmony_ci */ 13232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCRCB_420_SP, 13332a6e48fSopenharmony_ci /** 13432a6e48fSopenharmony_ci * YCBCR422 plannar format 13532a6e48fSopenharmony_ci * @since 12 13632a6e48fSopenharmony_ci */ 13732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P, 13832a6e48fSopenharmony_ci /** 13932a6e48fSopenharmony_ci * YCRCB422 plannar format 14032a6e48fSopenharmony_ci * @since 12 14132a6e48fSopenharmony_ci */ 14232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCRCB_422_P, 14332a6e48fSopenharmony_ci /** 14432a6e48fSopenharmony_ci * YCBCR420 plannar format 14532a6e48fSopenharmony_ci * @since 12 14632a6e48fSopenharmony_ci */ 14732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P, 14832a6e48fSopenharmony_ci /** 14932a6e48fSopenharmony_ci * YCRCB420 plannar format 15032a6e48fSopenharmony_ci * @since 12 15132a6e48fSopenharmony_ci */ 15232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCRCB_420_P, 15332a6e48fSopenharmony_ci /** 15432a6e48fSopenharmony_ci * YUYV422 packed format 15532a6e48fSopenharmony_ci * @since 12 15632a6e48fSopenharmony_ci */ 15732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG, 15832a6e48fSopenharmony_ci /** 15932a6e48fSopenharmony_ci * UYVY422 packed format 16032a6e48fSopenharmony_ci * @since 12 16132a6e48fSopenharmony_ci */ 16232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG, 16332a6e48fSopenharmony_ci /** 16432a6e48fSopenharmony_ci * YVYU422 packed format 16532a6e48fSopenharmony_ci * @since 12 16632a6e48fSopenharmony_ci */ 16732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG, 16832a6e48fSopenharmony_ci /** 16932a6e48fSopenharmony_ci * VYUY422 packed format 17032a6e48fSopenharmony_ci * @since 12 17132a6e48fSopenharmony_ci */ 17232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG, 17332a6e48fSopenharmony_ci /** 17432a6e48fSopenharmony_ci * RGBA_1010102 packed format 17532a6e48fSopenharmony_ci * @since 12 17632a6e48fSopenharmony_ci */ 17732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RGBA_1010102, 17832a6e48fSopenharmony_ci /** 17932a6e48fSopenharmony_ci * YCBCR420 semi-planar 10bit packed format 18032a6e48fSopenharmony_ci * @since 12 18132a6e48fSopenharmony_ci */ 18232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_P010, 18332a6e48fSopenharmony_ci /** 18432a6e48fSopenharmony_ci * YCRCB420 semi-planar 10bit packed format 18532a6e48fSopenharmony_ci * @since 12 18632a6e48fSopenharmony_ci */ 18732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCRCB_P010, 18832a6e48fSopenharmony_ci /** 18932a6e48fSopenharmony_ci * Raw 10bit packed format 19032a6e48fSopenharmony_ci * @since 12 19132a6e48fSopenharmony_ci */ 19232a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_RAW10, 19332a6e48fSopenharmony_ci /** 19432a6e48fSopenharmony_ci * vender mask format 19532a6e48fSopenharmony_ci * @since 12 19632a6e48fSopenharmony_ci */ 19732a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000, 19832a6e48fSopenharmony_ci NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF /// < Invalid pixel format */ 19932a6e48fSopenharmony_ci} OH_NativeBuffer_Format; 20032a6e48fSopenharmony_ci 20132a6e48fSopenharmony_ci/** 20232a6e48fSopenharmony_ci * @brief Indicates the color space of a native buffer. 20332a6e48fSopenharmony_ci * 20432a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 20532a6e48fSopenharmony_ci * @since 11 20632a6e48fSopenharmony_ci * @version 1.0 20732a6e48fSopenharmony_ci */ 20832a6e48fSopenharmony_citypedef enum OH_NativeBuffer_ColorSpace { 20932a6e48fSopenharmony_ci /** None color space */ 21032a6e48fSopenharmony_ci OH_COLORSPACE_NONE, 21132a6e48fSopenharmony_ci /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_FULL << 21) */ 21232a6e48fSopenharmony_ci OH_COLORSPACE_BT601_EBU_FULL, 21332a6e48fSopenharmony_ci /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21)*/ 21432a6e48fSopenharmony_ci OH_COLORSPACE_BT601_SMPTE_C_FULL, 21532a6e48fSopenharmony_ci /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_FULL << 21) */ 21632a6e48fSopenharmony_ci OH_COLORSPACE_BT709_FULL, 21732a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ 21832a6e48fSopenharmony_ci OH_COLORSPACE_BT2020_HLG_FULL, 21932a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ 22032a6e48fSopenharmony_ci OH_COLORSPACE_BT2020_PQ_FULL, 22132a6e48fSopenharmony_ci /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_LIMITED << 21) */ 22232a6e48fSopenharmony_ci OH_COLORSPACE_BT601_EBU_LIMIT, 22332a6e48fSopenharmony_ci /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */ 22432a6e48fSopenharmony_ci OH_COLORSPACE_BT601_SMPTE_C_LIMIT, 22532a6e48fSopenharmony_ci /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_LIMITED << 21) */ 22632a6e48fSopenharmony_ci OH_COLORSPACE_BT709_LIMIT, 22732a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */ 22832a6e48fSopenharmony_ci OH_COLORSPACE_BT2020_HLG_LIMIT, 22932a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */ 23032a6e48fSopenharmony_ci OH_COLORSPACE_BT2020_PQ_LIMIT, 23132a6e48fSopenharmony_ci /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21) */ 23232a6e48fSopenharmony_ci OH_COLORSPACE_SRGB_FULL, 23332a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ 23432a6e48fSopenharmony_ci OH_COLORSPACE_P3_FULL, 23532a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ 23632a6e48fSopenharmony_ci OH_COLORSPACE_P3_HLG_FULL, 23732a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */ 23832a6e48fSopenharmony_ci OH_COLORSPACE_P3_PQ_FULL, 23932a6e48fSopenharmony_ci /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_FULL << 21) */ 24032a6e48fSopenharmony_ci OH_COLORSPACE_ADOBERGB_FULL, 24132a6e48fSopenharmony_ci /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */ 24232a6e48fSopenharmony_ci OH_COLORSPACE_SRGB_LIMIT, 24332a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ 24432a6e48fSopenharmony_ci OH_COLORSPACE_P3_LIMIT, 24532a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ 24632a6e48fSopenharmony_ci OH_COLORSPACE_P3_HLG_LIMIT, 24732a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */ 24832a6e48fSopenharmony_ci OH_COLORSPACE_P3_PQ_LIMIT, 24932a6e48fSopenharmony_ci /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_LIMITED << 21) */ 25032a6e48fSopenharmony_ci OH_COLORSPACE_ADOBERGB_LIMIT, 25132a6e48fSopenharmony_ci /** COLORPRIMARIES_SRGB | (TRANSFUNC_LINEAR << 8) */ 25232a6e48fSopenharmony_ci OH_COLORSPACE_LINEAR_SRGB, 25332a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_LINEAR_SRGB */ 25432a6e48fSopenharmony_ci OH_COLORSPACE_LINEAR_BT709, 25532a6e48fSopenharmony_ci /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_LINEAR << 8) */ 25632a6e48fSopenharmony_ci OH_COLORSPACE_LINEAR_P3, 25732a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_LINEAR << 8) */ 25832a6e48fSopenharmony_ci OH_COLORSPACE_LINEAR_BT2020, 25932a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_SRGB_FULL */ 26032a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_SRGB, 26132a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_P3_FULL */ 26232a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_P3_SRGB, 26332a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_P3_HLG_FULL */ 26432a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_P3_HLG, 26532a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_P3_PQ_FULL */ 26632a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_P3_PQ, 26732a6e48fSopenharmony_ci /** COLORPRIMARIES_BT2020 | (TRANSFUNC_SRGB << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */ 26832a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_BT2020_SRGB, 26932a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_BT2020_HLG_FULL */ 27032a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_BT2020_HLG, 27132a6e48fSopenharmony_ci /** equal to OH_COLORSPACE_BT2020_PQ_FULL */ 27232a6e48fSopenharmony_ci OH_COLORSPACE_DISPLAY_BT2020_PQ, 27332a6e48fSopenharmony_ci} OH_NativeBuffer_ColorSpace; 27432a6e48fSopenharmony_ci 27532a6e48fSopenharmony_ci/** 27632a6e48fSopenharmony_ci * @brief Indicates the transform type of a native buffer. 27732a6e48fSopenharmony_ci * 27832a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 27932a6e48fSopenharmony_ci * @since 12 28032a6e48fSopenharmony_ci * @version 1.0 28132a6e48fSopenharmony_ci */ 28232a6e48fSopenharmony_citypedef enum OH_NativeBuffer_TransformType { 28332a6e48fSopenharmony_ci NATIVEBUFFER_ROTATE_NONE = 0, /**< No rotation */ 28432a6e48fSopenharmony_ci NATIVEBUFFER_ROTATE_90, /**< Rotation by 90 degrees */ 28532a6e48fSopenharmony_ci NATIVEBUFFER_ROTATE_180, /**< Rotation by 180 degrees */ 28632a6e48fSopenharmony_ci NATIVEBUFFER_ROTATE_270, /**< Rotation by 270 degrees */ 28732a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_H, /**< Flip horizontally */ 28832a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_V, /**< Flip vertically */ 28932a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_H_ROT90, /**< Flip horizontally and rotate 90 degrees */ 29032a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_V_ROT90, /**< Flip vertically and rotate 90 degrees */ 29132a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_H_ROT180, /**< Flip horizontally and rotate 180 degrees */ 29232a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_V_ROT180, /**< Flip vertically and rotate 180 degrees */ 29332a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_H_ROT270, /**< Flip horizontally and rotate 270 degrees */ 29432a6e48fSopenharmony_ci NATIVEBUFFER_FLIP_V_ROT270, /**< Flip vertically and rotate 270 degrees */ 29532a6e48fSopenharmony_ci} OH_NativeBuffer_TransformType; 29632a6e48fSopenharmony_ci 29732a6e48fSopenharmony_ci/** 29832a6e48fSopenharmony_ci * @brief Indicates the color gamut of a native buffer. 29932a6e48fSopenharmony_ci * 30032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 30132a6e48fSopenharmony_ci * @since 12 30232a6e48fSopenharmony_ci * @version 1.0 30332a6e48fSopenharmony_ci */ 30432a6e48fSopenharmony_citypedef enum OH_NativeBuffer_ColorGamut { 30532a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_NATIVE = 0, /**< Native or default */ 30632a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 = 1, /**< Standard BT601 */ 30732a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 = 2, /**< Standard BT709 */ 30832a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_DCI_P3 = 3, /**< DCI P3 */ 30932a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_SRGB = 4, /**< SRGB */ 31032a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB = 5, /**< Adobe RGB */ 31132a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 = 6, /**< Display P3 */ 31232a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_BT2020 = 7, /**< BT2020 */ 31332a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ = 8, /**< BT2100 PQ */ 31432a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG = 9, /**< BT2100 HLG */ 31532a6e48fSopenharmony_ci NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 = 10, /**< Display BT2020 */ 31632a6e48fSopenharmony_ci} OH_NativeBuffer_ColorGamut; 31732a6e48fSopenharmony_ci 31832a6e48fSopenharmony_ci/** 31932a6e48fSopenharmony_ci * @brief <b>OH_NativeBuffer</b> config. \n 32032a6e48fSopenharmony_ci * Used to allocating new <b>OH_NativeBuffer</b> andquery parameters if existing ones. 32132a6e48fSopenharmony_ci * 32232a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 32332a6e48fSopenharmony_ci * @since 9 32432a6e48fSopenharmony_ci * @version 1.0 32532a6e48fSopenharmony_ci */ 32632a6e48fSopenharmony_citypedef struct { 32732a6e48fSopenharmony_ci int32_t width; ///< Width in pixels 32832a6e48fSopenharmony_ci int32_t height; ///< Height in pixels 32932a6e48fSopenharmony_ci int32_t format; ///< One of PixelFormat 33032a6e48fSopenharmony_ci int32_t usage; ///< Combination of buffer usage 33132a6e48fSopenharmony_ci int32_t stride; ///< the stride of memory in bytes 33232a6e48fSopenharmony_ci} OH_NativeBuffer_Config; 33332a6e48fSopenharmony_ci 33432a6e48fSopenharmony_ci/** 33532a6e48fSopenharmony_ci * @brief Holds info for a single image plane. \n 33632a6e48fSopenharmony_ci * 33732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 33832a6e48fSopenharmony_ci * @since 12 33932a6e48fSopenharmony_ci * @version 1.0 34032a6e48fSopenharmony_ci */ 34132a6e48fSopenharmony_citypedef struct { 34232a6e48fSopenharmony_ci /** 34332a6e48fSopenharmony_ci * Offset in bytes of plane. 34432a6e48fSopenharmony_ci */ 34532a6e48fSopenharmony_ci uint64_t offset; 34632a6e48fSopenharmony_ci /** 34732a6e48fSopenharmony_ci * Distance in bytes from the first value of one row of the image to the first value of the next row. 34832a6e48fSopenharmony_ci */ 34932a6e48fSopenharmony_ci uint32_t rowStride; 35032a6e48fSopenharmony_ci /** 35132a6e48fSopenharmony_ci * Distance in bytes from the first value of one column of the image to the first value of the next column. 35232a6e48fSopenharmony_ci */ 35332a6e48fSopenharmony_ci uint32_t columnStride; 35432a6e48fSopenharmony_ci} OH_NativeBuffer_Plane; 35532a6e48fSopenharmony_ci 35632a6e48fSopenharmony_ci/** 35732a6e48fSopenharmony_ci * @brief Holds all image plane. \n 35832a6e48fSopenharmony_ci * 35932a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 36032a6e48fSopenharmony_ci * @since 12 36132a6e48fSopenharmony_ci * @version 1.0 36232a6e48fSopenharmony_ci */ 36332a6e48fSopenharmony_citypedef struct { 36432a6e48fSopenharmony_ci uint32_t planeCount; ///< Number of distinct planes. 36532a6e48fSopenharmony_ci OH_NativeBuffer_Plane planes[4]; ///< Array of image planes. 36632a6e48fSopenharmony_ci} OH_NativeBuffer_Planes; 36732a6e48fSopenharmony_ci 36832a6e48fSopenharmony_ci/** 36932a6e48fSopenharmony_ci * @brief Indicates the HDR metadata type of a native buffer. 37032a6e48fSopenharmony_ci * 37132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 37232a6e48fSopenharmony_ci * @since 12 37332a6e48fSopenharmony_ci * @version 1.0 37432a6e48fSopenharmony_ci */ 37532a6e48fSopenharmony_citypedef enum OH_NativeBuffer_MetadataType { 37632a6e48fSopenharmony_ci OH_VIDEO_HDR_HLG, /**< HLG */ 37732a6e48fSopenharmony_ci OH_VIDEO_HDR_HDR10, /**< HDR10 */ 37832a6e48fSopenharmony_ci OH_VIDEO_HDR_VIVID, /**< HDR VIVID */ 37932a6e48fSopenharmony_ci OH_VIDEO_NONE /**< NONE Metadata */ 38032a6e48fSopenharmony_ci} OH_NativeBuffer_MetadataType; 38132a6e48fSopenharmony_ci 38232a6e48fSopenharmony_ci/** 38332a6e48fSopenharmony_ci * @brief Indicates the color x and y. 38432a6e48fSopenharmony_ci * 38532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 38632a6e48fSopenharmony_ci * @since 12 38732a6e48fSopenharmony_ci * @version 1.0 38832a6e48fSopenharmony_ci */ 38932a6e48fSopenharmony_citypedef struct { 39032a6e48fSopenharmony_ci float x; /**< color X */ 39132a6e48fSopenharmony_ci float y; /**< color Y */ 39232a6e48fSopenharmony_ci} OH_NativeBuffer_ColorXY; 39332a6e48fSopenharmony_ci 39432a6e48fSopenharmony_ci/** 39532a6e48fSopenharmony_ci * @brief Indicates the smpte2086 metadata. 39632a6e48fSopenharmony_ci * 39732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 39832a6e48fSopenharmony_ci * @since 12 39932a6e48fSopenharmony_ci * @version 1.0 40032a6e48fSopenharmony_ci */ 40132a6e48fSopenharmony_citypedef struct { 40232a6e48fSopenharmony_ci OH_NativeBuffer_ColorXY displaPrimaryRed; /**< primary red */ 40332a6e48fSopenharmony_ci OH_NativeBuffer_ColorXY displaPrimaryGreen; /**< primary green */ 40432a6e48fSopenharmony_ci OH_NativeBuffer_ColorXY displaPrimaryBlue; /**< primary blue */ 40532a6e48fSopenharmony_ci OH_NativeBuffer_ColorXY whitePoint; /**< white point */ 40632a6e48fSopenharmony_ci float maxLuminance; /**< max luminance */ 40732a6e48fSopenharmony_ci float minLuminance; /**< min luminance */ 40832a6e48fSopenharmony_ci} OH_NativeBuffer_Smpte2086; 40932a6e48fSopenharmony_ci 41032a6e48fSopenharmony_ci/** 41132a6e48fSopenharmony_ci * @brief Indicates the cta861.3 metadata. 41232a6e48fSopenharmony_ci * 41332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 41432a6e48fSopenharmony_ci * @since 12 41532a6e48fSopenharmony_ci * @version 1.0 41632a6e48fSopenharmony_ci */ 41732a6e48fSopenharmony_citypedef struct { 41832a6e48fSopenharmony_ci float maxContentLightLevel; /**< max content lightLevel */ 41932a6e48fSopenharmony_ci float maxFrameAverageLightLevel; /**< max frame average light level */ 42032a6e48fSopenharmony_ci} OH_NativeBuffer_Cta861; 42132a6e48fSopenharmony_ci 42232a6e48fSopenharmony_ci/** 42332a6e48fSopenharmony_ci * @brief Indicates the HDR static metadata. 42432a6e48fSopenharmony_ci * 42532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 42632a6e48fSopenharmony_ci * @since 12 42732a6e48fSopenharmony_ci * @version 1.0 42832a6e48fSopenharmony_ci */ 42932a6e48fSopenharmony_citypedef struct { 43032a6e48fSopenharmony_ci OH_NativeBuffer_Smpte2086 smpte2086; /**< smpte 2086 metadata*/ 43132a6e48fSopenharmony_ci OH_NativeBuffer_Cta861 cta861; /**< CTA-861.3 metadata*/ 43232a6e48fSopenharmony_ci} OH_NativeBuffer_StaticMetadata; 43332a6e48fSopenharmony_ci 43432a6e48fSopenharmony_ci/** 43532a6e48fSopenharmony_ci * @brief Indicates the HDR metadata key of a native buffer. 43632a6e48fSopenharmony_ci * 43732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 43832a6e48fSopenharmony_ci * @since 12 43932a6e48fSopenharmony_ci * @version 1.0 44032a6e48fSopenharmony_ci */ 44132a6e48fSopenharmony_citypedef enum OH_NativeBuffer_MetadataKey { 44232a6e48fSopenharmony_ci OH_HDR_METADATA_TYPE, /**< value: OH_NativeBuffer_MetadataType*/ 44332a6e48fSopenharmony_ci OH_HDR_STATIC_METADATA, /**< value: OH_NativeBuffer_StaticMetadata*/ 44432a6e48fSopenharmony_ci OH_HDR_DYNAMIC_METADATA /**< byte stream of SEI in video stream*/ 44532a6e48fSopenharmony_ci} OH_NativeBuffer_MetadataKey; 44632a6e48fSopenharmony_ci 44732a6e48fSopenharmony_ci/** 44832a6e48fSopenharmony_ci * @brief Alloc a <b>OH_NativeBuffer</b> that matches the passed BufferRequestConfig. \n 44932a6e48fSopenharmony_ci * A new <b>OH_NativeBuffer</b> instance is created each time this function is called. 45032a6e48fSopenharmony_ci * 45132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 45232a6e48fSopenharmony_ci * @param config Indicates the pointer to a <b>BufferRequestConfig</b> instance. 45332a6e48fSopenharmony_ci * @return Returns the pointer to the <b>OH_NativeBuffer</b> instance created if the operation is successful, \n 45432a6e48fSopenharmony_ci * returns <b>NULL</b> otherwise. 45532a6e48fSopenharmony_ci * @since 9 45632a6e48fSopenharmony_ci * @version 1.0 45732a6e48fSopenharmony_ci */ 45832a6e48fSopenharmony_ciOH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config); 45932a6e48fSopenharmony_ci 46032a6e48fSopenharmony_ci/** 46132a6e48fSopenharmony_ci * @brief Adds the reference count of a OH_NativeBuffer. 46232a6e48fSopenharmony_ci * 46332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 46432a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 46532a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed. 46632a6e48fSopenharmony_ci * @since 9 46732a6e48fSopenharmony_ci * @version 1.0 46832a6e48fSopenharmony_ci */ 46932a6e48fSopenharmony_ciint32_t OH_NativeBuffer_Reference(OH_NativeBuffer *buffer); 47032a6e48fSopenharmony_ci 47132a6e48fSopenharmony_ci/** 47232a6e48fSopenharmony_ci * @brief Decreases the reference count of a OH_NativeBuffer and, when the reference count reaches 0, \n 47332a6e48fSopenharmony_ci * destroys this OH_NativeBuffer. 47432a6e48fSopenharmony_ci * 47532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 47632a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 47732a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed. 47832a6e48fSopenharmony_ci * @since 9 47932a6e48fSopenharmony_ci * @version 1.0 48032a6e48fSopenharmony_ci */ 48132a6e48fSopenharmony_ciint32_t OH_NativeBuffer_Unreference(OH_NativeBuffer *buffer); 48232a6e48fSopenharmony_ci 48332a6e48fSopenharmony_ci/** 48432a6e48fSopenharmony_ci * @brief Return a config of the OH_NativeBuffer in the passed OHNativeBufferConfig struct. 48532a6e48fSopenharmony_ci * 48632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 48732a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 48832a6e48fSopenharmony_ci * @param config Indicates the pointer to the <b>NativeBufferConfig</b> of the buffer. 48932a6e48fSopenharmony_ci * @return <b>void</b> 49032a6e48fSopenharmony_ci * @since 9 49132a6e48fSopenharmony_ci * @version 1.0 49232a6e48fSopenharmony_ci */ 49332a6e48fSopenharmony_civoid OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* config); 49432a6e48fSopenharmony_ci 49532a6e48fSopenharmony_ci/** 49632a6e48fSopenharmony_ci * @brief Provide direct cpu access to the OH_NativeBuffer in the process's address space. 49732a6e48fSopenharmony_ci * 49832a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 49932a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 50032a6e48fSopenharmony_ci * @param virAddr Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory. 50132a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed. 50232a6e48fSopenharmony_ci * @since 9 50332a6e48fSopenharmony_ci * @version 1.0 50432a6e48fSopenharmony_ci */ 50532a6e48fSopenharmony_ci 50632a6e48fSopenharmony_ciint32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr); 50732a6e48fSopenharmony_ci 50832a6e48fSopenharmony_ci/** 50932a6e48fSopenharmony_ci * @brief Remove direct cpu access ability of the OH_NativeBuffer in the process's address space. 51032a6e48fSopenharmony_ci * 51132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 51232a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 51332a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed. 51432a6e48fSopenharmony_ci * @since 9 51532a6e48fSopenharmony_ci * @version 1.0 51632a6e48fSopenharmony_ci */ 51732a6e48fSopenharmony_ciint32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); 51832a6e48fSopenharmony_ci 51932a6e48fSopenharmony_ci/** 52032a6e48fSopenharmony_ci * @brief Get the systen wide unique sequence number of the OH_NativeBuffer. 52132a6e48fSopenharmony_ci * 52232a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 52332a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 52432a6e48fSopenharmony_ci * @return Returns the sequence number, which is unique for each OH_NativeBuffer. 52532a6e48fSopenharmony_ci * @since 9 52632a6e48fSopenharmony_ci * @version 1.0 52732a6e48fSopenharmony_ci */ 52832a6e48fSopenharmony_ciuint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); 52932a6e48fSopenharmony_ci 53032a6e48fSopenharmony_ci/** 53132a6e48fSopenharmony_ci * @brief Provide direct cpu access to the potentially multi-plannar OH_NativeBuffer in the process's address space. 53232a6e48fSopenharmony_ci * 53332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 53432a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 53532a6e48fSopenharmony_ci * @param virAddr Indicates the address of the <b>OH_NativeBuffer</b> in virtual memory. 53632a6e48fSopenharmony_ci * @param outPlanes Indicates all image planes that contain the pixel data. 53732a6e48fSopenharmony_ci * @return Returns an error code, 0 is sucess, otherwise, failed. 53832a6e48fSopenharmony_ci * @since 12 53932a6e48fSopenharmony_ci * @version 1.0 54032a6e48fSopenharmony_ci */ 54132a6e48fSopenharmony_ciint32_t OH_NativeBuffer_MapPlanes(OH_NativeBuffer *buffer, void **virAddr, OH_NativeBuffer_Planes *outPlanes); 54232a6e48fSopenharmony_ci 54332a6e48fSopenharmony_ci/** 54432a6e48fSopenharmony_ci * @brief Converts an <b>OHNativeWindowBuffer</b> instance to an <b>OH_NativeBuffer</b>. 54532a6e48fSopenharmony_ci * 54632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 54732a6e48fSopenharmony_ci * @param nativeWindowBuffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance. 54832a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> pointer. 54932a6e48fSopenharmony_ci * @return Returns an error code, 0 is sucess, otherwise, failed. 55032a6e48fSopenharmony_ci * @since 12 55132a6e48fSopenharmony_ci * @version 1.0 55232a6e48fSopenharmony_ci */ 55332a6e48fSopenharmony_ciint32_t OH_NativeBuffer_FromNativeWindowBuffer(OHNativeWindowBuffer *nativeWindowBuffer, OH_NativeBuffer **buffer); 55432a6e48fSopenharmony_ci 55532a6e48fSopenharmony_ci/** 55632a6e48fSopenharmony_ci * @brief Set the color space of the OH_NativeBuffer. 55732a6e48fSopenharmony_ci * 55832a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 55932a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 56032a6e48fSopenharmony_ci * @param colorSpace Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>. 56132a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed. 56232a6e48fSopenharmony_ci * @since 11 56332a6e48fSopenharmony_ci * @version 1.0 56432a6e48fSopenharmony_ci */ 56532a6e48fSopenharmony_ciint32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace); 56632a6e48fSopenharmony_ci 56732a6e48fSopenharmony_ci/** 56832a6e48fSopenharmony_ci * @brief Get the color space of the OH_NativeBuffer. 56932a6e48fSopenharmony_ci * 57032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 57132a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 57232a6e48fSopenharmony_ci * @param colorSpace Indicates the color space of native buffer, see <b>OH_NativeBuffer_ColorSpace</b>. 57332a6e48fSopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success. 57432a6e48fSopenharmony_ci * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer is NULL. 57532a6e48fSopenharmony_ci * {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect colorSpace state. 57632a6e48fSopenharmony_ci * @since 12 57732a6e48fSopenharmony_ci * @version 1.0 57832a6e48fSopenharmony_ci */ 57932a6e48fSopenharmony_ciint32_t OH_NativeBuffer_GetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace *colorSpace); 58032a6e48fSopenharmony_ci 58132a6e48fSopenharmony_ci/** 58232a6e48fSopenharmony_ci * @brief Set the metadata type of the OH_NativeBuffer. 58332a6e48fSopenharmony_ci * 58432a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 58532a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 58632a6e48fSopenharmony_ci * @param metadataKey Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>. 58732a6e48fSopenharmony_ci * @param size Indicates the size of a uint8_t vector. 58832a6e48fSopenharmony_ci * @param metadata Indicates the pointer to a uint8_t vector. 58932a6e48fSopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success. 59032a6e48fSopenharmony_ci * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer or metadata is NULL. 59132a6e48fSopenharmony_ci * {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state. 59232a6e48fSopenharmony_ci * {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key. 59332a6e48fSopenharmony_ci * @since 12 59432a6e48fSopenharmony_ci * @version 1.0 59532a6e48fSopenharmony_ci */ 59632a6e48fSopenharmony_ciint32_t OH_NativeBuffer_SetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey, 59732a6e48fSopenharmony_ci int32_t size, uint8_t *metadata); 59832a6e48fSopenharmony_ci 59932a6e48fSopenharmony_ci/** 60032a6e48fSopenharmony_ci * @brief Set the metadata type of the OH_NativeBuffer. 60132a6e48fSopenharmony_ci * 60232a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer 60332a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OH_NativeBuffer</b> instance. 60432a6e48fSopenharmony_ci * @param metadataKey Indicates the metadata type of native buffer, see <b>OH_NativeBuffer_MetadataKey</b>. 60532a6e48fSopenharmony_ci * @param size Indicates the size of a uint8_t vector. 60632a6e48fSopenharmony_ci * @param metadata Indicates the pointer to a uint8_t vector. 60732a6e48fSopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success. 60832a6e48fSopenharmony_ci * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - buffer, metadata, or size is NULL. 60932a6e48fSopenharmony_ci * {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - Incorrect metadata state. 61032a6e48fSopenharmony_ci * {@link NATIVE_ERROR_UNSUPPORTED} 50102000 - Unsupported metadata key. 61132a6e48fSopenharmony_ci * @since 12 61232a6e48fSopenharmony_ci * @version 1.0 61332a6e48fSopenharmony_ci */ 61432a6e48fSopenharmony_ciint32_t OH_NativeBuffer_GetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey, 61532a6e48fSopenharmony_ci int32_t *size, uint8_t **metadata); 61632a6e48fSopenharmony_ci#ifdef __cplusplus 61732a6e48fSopenharmony_ci} 61832a6e48fSopenharmony_ci#endif 61932a6e48fSopenharmony_ci 62032a6e48fSopenharmony_ci/** @} */ 62132a6e48fSopenharmony_ci#endif