132a6e48fSopenharmony_ci/*
232a6e48fSopenharmony_ci * Copyright (c) 2021-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_EXTERNAL_NATIVE_WINDOW_H_
1732a6e48fSopenharmony_ci#define NDK_INCLUDE_EXTERNAL_NATIVE_WINDOW_H_
1832a6e48fSopenharmony_ci
1932a6e48fSopenharmony_ci/**
2032a6e48fSopenharmony_ci * @addtogroup NativeWindow
2132a6e48fSopenharmony_ci * @{
2232a6e48fSopenharmony_ci *
2332a6e48fSopenharmony_ci * @brief Provides the native window capability for connection to the EGL.
2432a6e48fSopenharmony_ci *
2532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
2632a6e48fSopenharmony_ci * @since 8
2732a6e48fSopenharmony_ci * @version 1.0
2832a6e48fSopenharmony_ci */
2932a6e48fSopenharmony_ci
3032a6e48fSopenharmony_ci/**
3132a6e48fSopenharmony_ci * @file external_window.h
3232a6e48fSopenharmony_ci *
3332a6e48fSopenharmony_ci * @brief Defines the functions for obtaining and using a native window.
3432a6e48fSopenharmony_ci *
3532a6e48fSopenharmony_ci * @library libnative_window.so
3632a6e48fSopenharmony_ci * @since 8
3732a6e48fSopenharmony_ci * @version 1.0
3832a6e48fSopenharmony_ci */
3932a6e48fSopenharmony_ci
4032a6e48fSopenharmony_ci#include <stdint.h>
4132a6e48fSopenharmony_ci#include "buffer_handle.h"
4232a6e48fSopenharmony_ci
4332a6e48fSopenharmony_ci#ifdef __cplusplus
4432a6e48fSopenharmony_ciextern "C" {
4532a6e48fSopenharmony_ci#endif
4632a6e48fSopenharmony_citypedef struct OH_NativeBuffer OH_NativeBuffer;
4732a6e48fSopenharmony_ci
4832a6e48fSopenharmony_ci/**
4932a6e48fSopenharmony_ci * @brief Defines the ipc parcel.
5032a6e48fSopenharmony_ci *
5132a6e48fSopenharmony_ci * @since 12
5232a6e48fSopenharmony_ci * @version 1.0
5332a6e48fSopenharmony_ci */
5432a6e48fSopenharmony_citypedef struct OHIPCParcel OHIPCParcel;
5532a6e48fSopenharmony_ci
5632a6e48fSopenharmony_ci/**
5732a6e48fSopenharmony_ci * @brief native window.
5832a6e48fSopenharmony_ci * @since 8
5932a6e48fSopenharmony_ci */
6032a6e48fSopenharmony_cistruct NativeWindow;
6132a6e48fSopenharmony_ci
6232a6e48fSopenharmony_ci/**
6332a6e48fSopenharmony_ci * @brief native window buffer.
6432a6e48fSopenharmony_ci * @since 8
6532a6e48fSopenharmony_ci */
6632a6e48fSopenharmony_cistruct NativeWindowBuffer;
6732a6e48fSopenharmony_ci
6832a6e48fSopenharmony_ci/**
6932a6e48fSopenharmony_ci * @brief define the new type name OHNativeWindow for struct NativeWindow.
7032a6e48fSopenharmony_ci * @since 8
7132a6e48fSopenharmony_ci */
7232a6e48fSopenharmony_citypedef struct NativeWindow OHNativeWindow;
7332a6e48fSopenharmony_ci
7432a6e48fSopenharmony_ci/**
7532a6e48fSopenharmony_ci * @brief define the new type name OHNativeWindowBuffer for struct NativeWindowBuffer.
7632a6e48fSopenharmony_ci * @since 8
7732a6e48fSopenharmony_ci */
7832a6e48fSopenharmony_citypedef struct NativeWindowBuffer OHNativeWindowBuffer;
7932a6e48fSopenharmony_ci
8032a6e48fSopenharmony_ci/**
8132a6e48fSopenharmony_ci * @brief indicates a dirty region where content is updated.
8232a6e48fSopenharmony_ci * @since 8
8332a6e48fSopenharmony_ci */
8432a6e48fSopenharmony_citypedef struct Region {
8532a6e48fSopenharmony_ci    /** if rects is nullptr, fill the Buffer dirty size by default */
8632a6e48fSopenharmony_ci    struct Rect {
8732a6e48fSopenharmony_ci        int32_t x;
8832a6e48fSopenharmony_ci        int32_t y;
8932a6e48fSopenharmony_ci        uint32_t w;
9032a6e48fSopenharmony_ci        uint32_t h;
9132a6e48fSopenharmony_ci    } *rects;
9232a6e48fSopenharmony_ci    /** if rectNumber is 0, fill the Buffer dirty size by default */
9332a6e48fSopenharmony_ci    int32_t rectNumber;
9432a6e48fSopenharmony_ci}Region;
9532a6e48fSopenharmony_ci
9632a6e48fSopenharmony_ci
9732a6e48fSopenharmony_ci/**
9832a6e48fSopenharmony_ci * @brief Indicates the operation code in the function OH_NativeWindow_NativeWindowHandleOpt.
9932a6e48fSopenharmony_ci * @since 8
10032a6e48fSopenharmony_ci */
10132a6e48fSopenharmony_citypedef enum NativeWindowOperation {
10232a6e48fSopenharmony_ci    /**
10332a6e48fSopenharmony_ci     * set native window buffer geometry,
10432a6e48fSopenharmony_ci     * variable parameter in function is
10532a6e48fSopenharmony_ci     * [in] int32_t width, [in] int32_t height
10632a6e48fSopenharmony_ci     */
10732a6e48fSopenharmony_ci    SET_BUFFER_GEOMETRY,
10832a6e48fSopenharmony_ci    /**
10932a6e48fSopenharmony_ci     * get native window buffer geometry,
11032a6e48fSopenharmony_ci     * variable parameter in function is
11132a6e48fSopenharmony_ci     * [out] int32_t *height, [out] int32_t *width
11232a6e48fSopenharmony_ci     */
11332a6e48fSopenharmony_ci    GET_BUFFER_GEOMETRY,
11432a6e48fSopenharmony_ci    /**
11532a6e48fSopenharmony_ci     * get native window buffer format,
11632a6e48fSopenharmony_ci     * variable parameter in function is
11732a6e48fSopenharmony_ci     * [out] int32_t *format
11832a6e48fSopenharmony_ci     */
11932a6e48fSopenharmony_ci    GET_FORMAT,
12032a6e48fSopenharmony_ci    /**
12132a6e48fSopenharmony_ci     * set native window buffer format,
12232a6e48fSopenharmony_ci     * variable parameter in function is
12332a6e48fSopenharmony_ci     * [in] int32_t format
12432a6e48fSopenharmony_ci     */
12532a6e48fSopenharmony_ci    SET_FORMAT,
12632a6e48fSopenharmony_ci    /**
12732a6e48fSopenharmony_ci     * get native window buffer usage,
12832a6e48fSopenharmony_ci     * variable parameter in function is
12932a6e48fSopenharmony_ci     * [out] uint64_t *usage.
13032a6e48fSopenharmony_ci     */
13132a6e48fSopenharmony_ci    GET_USAGE,
13232a6e48fSopenharmony_ci    /**
13332a6e48fSopenharmony_ci     * set native window buffer usage,
13432a6e48fSopenharmony_ci     * variable parameter in function is
13532a6e48fSopenharmony_ci     * [in] uint64_t usage.
13632a6e48fSopenharmony_ci     */
13732a6e48fSopenharmony_ci    SET_USAGE,
13832a6e48fSopenharmony_ci    /**
13932a6e48fSopenharmony_ci     * set native window buffer stride in bytes,
14032a6e48fSopenharmony_ci     * variable parameter in function is
14132a6e48fSopenharmony_ci     * [in] int32_t stride, in bytes.
14232a6e48fSopenharmony_ci     */
14332a6e48fSopenharmony_ci    SET_STRIDE,
14432a6e48fSopenharmony_ci    /**
14532a6e48fSopenharmony_ci     * get native window buffer stride in bytes,
14632a6e48fSopenharmony_ci     * variable parameter in function is
14732a6e48fSopenharmony_ci     * [out] int32_t *stride, in bytes.
14832a6e48fSopenharmony_ci     */
14932a6e48fSopenharmony_ci    GET_STRIDE,
15032a6e48fSopenharmony_ci    /**
15132a6e48fSopenharmony_ci     * set native window buffer swap interval,
15232a6e48fSopenharmony_ci     * variable parameter in function is
15332a6e48fSopenharmony_ci     * [in] int32_t interval.
15432a6e48fSopenharmony_ci     * @deprecated since 14
15532a6e48fSopenharmony_ci     */
15632a6e48fSopenharmony_ci    SET_SWAP_INTERVAL,
15732a6e48fSopenharmony_ci    /**
15832a6e48fSopenharmony_ci     * get native window buffer swap interval,
15932a6e48fSopenharmony_ci     * variable parameter in function is
16032a6e48fSopenharmony_ci     * [out] int32_t *interval.
16132a6e48fSopenharmony_ci     * @deprecated since 14
16232a6e48fSopenharmony_ci     */
16332a6e48fSopenharmony_ci    GET_SWAP_INTERVAL,
16432a6e48fSopenharmony_ci    /**
16532a6e48fSopenharmony_ci     * set native window buffer timeout in milliseconds,
16632a6e48fSopenharmony_ci     * variable parameter in function is
16732a6e48fSopenharmony_ci     * [in] int32_t timeout, in milliseconds.
16832a6e48fSopenharmony_ci     */
16932a6e48fSopenharmony_ci    SET_TIMEOUT,
17032a6e48fSopenharmony_ci    /**
17132a6e48fSopenharmony_ci     * get native window buffer timeout in milliseconds,
17232a6e48fSopenharmony_ci     * variable parameter in function is
17332a6e48fSopenharmony_ci     * [out] int32_t *timeout, in milliseconds.
17432a6e48fSopenharmony_ci     */
17532a6e48fSopenharmony_ci    GET_TIMEOUT,
17632a6e48fSopenharmony_ci    /**
17732a6e48fSopenharmony_ci     * set native window buffer colorGamut,
17832a6e48fSopenharmony_ci     * variable parameter in function is
17932a6e48fSopenharmony_ci     * [in] int32_t colorGamut.
18032a6e48fSopenharmony_ci     */
18132a6e48fSopenharmony_ci    SET_COLOR_GAMUT,
18232a6e48fSopenharmony_ci    /**
18332a6e48fSopenharmony_ci     * get native window buffer colorGamut,
18432a6e48fSopenharmony_ci     * variable parameter in function is
18532a6e48fSopenharmony_ci     * [out int32_t *colorGamut].
18632a6e48fSopenharmony_ci     */
18732a6e48fSopenharmony_ci    GET_COLOR_GAMUT,
18832a6e48fSopenharmony_ci    /**
18932a6e48fSopenharmony_ci     * set native window buffer transform,
19032a6e48fSopenharmony_ci     * variable parameter in function is
19132a6e48fSopenharmony_ci     * [in] int32_t transform.
19232a6e48fSopenharmony_ci     */
19332a6e48fSopenharmony_ci    SET_TRANSFORM,
19432a6e48fSopenharmony_ci    /**
19532a6e48fSopenharmony_ci     * get native window buffer transform,
19632a6e48fSopenharmony_ci     * variable parameter in function is
19732a6e48fSopenharmony_ci     * [out] int32_t *transform.
19832a6e48fSopenharmony_ci     */
19932a6e48fSopenharmony_ci    GET_TRANSFORM,
20032a6e48fSopenharmony_ci    /**
20132a6e48fSopenharmony_ci     * set native window buffer uiTimestamp,
20232a6e48fSopenharmony_ci     * variable parameter in function is
20332a6e48fSopenharmony_ci     * [in] uint64_t uiTimestamp.
20432a6e48fSopenharmony_ci     */
20532a6e48fSopenharmony_ci    SET_UI_TIMESTAMP,
20632a6e48fSopenharmony_ci    /**
20732a6e48fSopenharmony_ci     * get native window bufferqueue size,
20832a6e48fSopenharmony_ci     * variable parameter in function is
20932a6e48fSopenharmony_ci     * [out] int32_t *size.
21032a6e48fSopenharmony_ci     * @since 12
21132a6e48fSopenharmony_ci     */
21232a6e48fSopenharmony_ci    GET_BUFFERQUEUE_SIZE,
21332a6e48fSopenharmony_ci    /**
21432a6e48fSopenharmony_ci     * set surface source type,
21532a6e48fSopenharmony_ci     * variable parameter in function is
21632a6e48fSopenharmony_ci     * [in] int32_t sourceType.
21732a6e48fSopenharmony_ci     * @since 12
21832a6e48fSopenharmony_ci     */
21932a6e48fSopenharmony_ci    SET_SOURCE_TYPE,
22032a6e48fSopenharmony_ci    /**
22132a6e48fSopenharmony_ci     * get surface source type,
22232a6e48fSopenharmony_ci     * variable parameter in function is
22332a6e48fSopenharmony_ci     * [out] int32_t *sourceType.
22432a6e48fSopenharmony_ci     * @since 12
22532a6e48fSopenharmony_ci     */
22632a6e48fSopenharmony_ci    GET_SOURCE_TYPE,
22732a6e48fSopenharmony_ci    /**
22832a6e48fSopenharmony_ci     * set app framework type,
22932a6e48fSopenharmony_ci     * variable parameter in function is
23032a6e48fSopenharmony_ci     * [in] char* frameworkType. maximum length is 64 bytes, otherwise the setting fails.
23132a6e48fSopenharmony_ci     * @since 12
23232a6e48fSopenharmony_ci     */
23332a6e48fSopenharmony_ci    SET_APP_FRAMEWORK_TYPE,
23432a6e48fSopenharmony_ci    /**
23532a6e48fSopenharmony_ci     * get app framework type,
23632a6e48fSopenharmony_ci     * variable parameter in function is
23732a6e48fSopenharmony_ci     * [out] char** frameworkType.
23832a6e48fSopenharmony_ci     * @since 12
23932a6e48fSopenharmony_ci     */
24032a6e48fSopenharmony_ci    GET_APP_FRAMEWORK_TYPE,
24132a6e48fSopenharmony_ci    /**
24232a6e48fSopenharmony_ci     * set hdr white point brightness,
24332a6e48fSopenharmony_ci     * variable parameter in function is
24432a6e48fSopenharmony_ci     * [in] float brightness. the value range is 0.0f to 1.0f.
24532a6e48fSopenharmony_ci     * @since 12
24632a6e48fSopenharmony_ci     */
24732a6e48fSopenharmony_ci    SET_HDR_WHITE_POINT_BRIGHTNESS,
24832a6e48fSopenharmony_ci    /**
24932a6e48fSopenharmony_ci     * set sdr white point brightness,
25032a6e48fSopenharmony_ci     * variable parameter in function is
25132a6e48fSopenharmony_ci     * [in] float brightness. the value range is 0.0f to 1.0f.
25232a6e48fSopenharmony_ci     * @since 12
25332a6e48fSopenharmony_ci     */
25432a6e48fSopenharmony_ci    SET_SDR_WHITE_POINT_BRIGHTNESS,
25532a6e48fSopenharmony_ci    /**
25632a6e48fSopenharmony_ci     * Set native window buffer desiredPresentTimestamp, indicates the desired time to present the buffer.\n
25732a6e48fSopenharmony_ci     * Which should be generated by std::chrono::steady_clock in nanoseconds.\n
25832a6e48fSopenharmony_ci     * It is only effective when RenderService is the consumer.\n
25932a6e48fSopenharmony_ci     * The buffer will wait until desiredPresentTimestamp is reached before being consumed and displayed.\n
26032a6e48fSopenharmony_ci     * If multiple buffers reach desiredPresentTimestamp, the earlier buffer will be dropped.\n
26132a6e48fSopenharmony_ci     * This Operation should be called before calling <b>OH_NativeWindow_NativeWindowFlushBuffer</b>.\n
26232a6e48fSopenharmony_ci     * If desiredPresentTimestamp is greater than 1 second of the consumer-provided timestamp,
26332a6e48fSopenharmony_ci     * the desiredPresentTimestamp will be ignored.\n
26432a6e48fSopenharmony_ci     * Variable parameter in function is
26532a6e48fSopenharmony_ci     * [in] int64_t desiredPresentTimestamp.
26632a6e48fSopenharmony_ci     * @since 14
26732a6e48fSopenharmony_ci     */
26832a6e48fSopenharmony_ci    SET_DESIRED_PRESENT_TIMESTAMP = 24,
26932a6e48fSopenharmony_ci} NativeWindowOperation;
27032a6e48fSopenharmony_ci
27132a6e48fSopenharmony_ci/**
27232a6e48fSopenharmony_ci * @brief Indicates Scaling Mode.
27332a6e48fSopenharmony_ci * @since 9
27432a6e48fSopenharmony_ci * @deprecated(since = "10")
27532a6e48fSopenharmony_ci */
27632a6e48fSopenharmony_citypedef enum {
27732a6e48fSopenharmony_ci    /**
27832a6e48fSopenharmony_ci     * the window content is not updated until a buffer of
27932a6e48fSopenharmony_ci     * the window size is received
28032a6e48fSopenharmony_ci     */
28132a6e48fSopenharmony_ci    OH_SCALING_MODE_FREEZE = 0,
28232a6e48fSopenharmony_ci    /**
28332a6e48fSopenharmony_ci     * the buffer is scaled in two dimensions to match the window size
28432a6e48fSopenharmony_ci     */
28532a6e48fSopenharmony_ci    OH_SCALING_MODE_SCALE_TO_WINDOW,
28632a6e48fSopenharmony_ci    /**
28732a6e48fSopenharmony_ci     * the buffer is uniformly scaled so that the smaller size of
28832a6e48fSopenharmony_ci     * the buffer matches the window size
28932a6e48fSopenharmony_ci     */
29032a6e48fSopenharmony_ci    OH_SCALING_MODE_SCALE_CROP,
29132a6e48fSopenharmony_ci    /**
29232a6e48fSopenharmony_ci     * the window is clipped to the size of the buffer's clipping rectangle
29332a6e48fSopenharmony_ci     * pixels outside the clipping rectangle are considered fully transparent.
29432a6e48fSopenharmony_ci     */
29532a6e48fSopenharmony_ci    OH_SCALING_MODE_NO_SCALE_CROP,
29632a6e48fSopenharmony_ci} OHScalingMode;
29732a6e48fSopenharmony_ci
29832a6e48fSopenharmony_ci/**
29932a6e48fSopenharmony_ci * @brief Indicates Scaling Mode.
30032a6e48fSopenharmony_ci * @since 12
30132a6e48fSopenharmony_ci */
30232a6e48fSopenharmony_citypedef enum {
30332a6e48fSopenharmony_ci    /**
30432a6e48fSopenharmony_ci     * the window content is not updated until a buffer of
30532a6e48fSopenharmony_ci     * the window size is received
30632a6e48fSopenharmony_ci     */
30732a6e48fSopenharmony_ci    OH_SCALING_MODE_FREEZE_V2 = 0,
30832a6e48fSopenharmony_ci    /**
30932a6e48fSopenharmony_ci     * the buffer is scaled in two dimensions to match the window size
31032a6e48fSopenharmony_ci     */
31132a6e48fSopenharmony_ci    OH_SCALING_MODE_SCALE_TO_WINDOW_V2,
31232a6e48fSopenharmony_ci    /**
31332a6e48fSopenharmony_ci     * the buffer is uniformly scaled so that the smaller size of
31432a6e48fSopenharmony_ci     * the buffer matches the window size
31532a6e48fSopenharmony_ci     */
31632a6e48fSopenharmony_ci    OH_SCALING_MODE_SCALE_CROP_V2,
31732a6e48fSopenharmony_ci    /**
31832a6e48fSopenharmony_ci     * the window is clipped to the size of the buffer's clipping rectangle
31932a6e48fSopenharmony_ci     * pixels outside the clipping rectangle are considered fully transparent.
32032a6e48fSopenharmony_ci     */
32132a6e48fSopenharmony_ci    OH_SCALING_MODE_NO_SCALE_CROP_V2,
32232a6e48fSopenharmony_ci    /**
32332a6e48fSopenharmony_ci     * Adapt to the buffer and scale proportionally to the buffer size. Prioritize displaying all buffer content.
32432a6e48fSopenharmony_ci     * If the size is not the same as the window size, fill the unfilled area of the window with a background color.
32532a6e48fSopenharmony_ci     */
32632a6e48fSopenharmony_ci    OH_SCALING_MODE_SCALE_FIT_V2,
32732a6e48fSopenharmony_ci} OHScalingModeV2;
32832a6e48fSopenharmony_ci
32932a6e48fSopenharmony_ci/**
33032a6e48fSopenharmony_ci * @brief Enumerates the HDR metadata keys.
33132a6e48fSopenharmony_ci * @since 9
33232a6e48fSopenharmony_ci * @deprecated(since = "10")
33332a6e48fSopenharmony_ci */
33432a6e48fSopenharmony_citypedef enum {
33532a6e48fSopenharmony_ci    OH_METAKEY_RED_PRIMARY_X = 0,
33632a6e48fSopenharmony_ci    OH_METAKEY_RED_PRIMARY_Y = 1,
33732a6e48fSopenharmony_ci    OH_METAKEY_GREEN_PRIMARY_X = 2,
33832a6e48fSopenharmony_ci    OH_METAKEY_GREEN_PRIMARY_Y = 3,
33932a6e48fSopenharmony_ci    OH_METAKEY_BLUE_PRIMARY_X = 4,
34032a6e48fSopenharmony_ci    OH_METAKEY_BLUE_PRIMARY_Y = 5,
34132a6e48fSopenharmony_ci    OH_METAKEY_WHITE_PRIMARY_X = 6,
34232a6e48fSopenharmony_ci    OH_METAKEY_WHITE_PRIMARY_Y = 7,
34332a6e48fSopenharmony_ci    OH_METAKEY_MAX_LUMINANCE = 8,
34432a6e48fSopenharmony_ci    OH_METAKEY_MIN_LUMINANCE = 9,
34532a6e48fSopenharmony_ci    OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10,
34632a6e48fSopenharmony_ci    OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,
34732a6e48fSopenharmony_ci    OH_METAKEY_HDR10_PLUS = 12,
34832a6e48fSopenharmony_ci    OH_METAKEY_HDR_VIVID = 13,
34932a6e48fSopenharmony_ci} OHHDRMetadataKey;
35032a6e48fSopenharmony_ci
35132a6e48fSopenharmony_ci/**
35232a6e48fSopenharmony_ci * @brief Defines the HDR metadata.
35332a6e48fSopenharmony_ci * @since 9
35432a6e48fSopenharmony_ci * @deprecated(since = "10")
35532a6e48fSopenharmony_ci */
35632a6e48fSopenharmony_citypedef struct {
35732a6e48fSopenharmony_ci    OHHDRMetadataKey key;
35832a6e48fSopenharmony_ci    float value;
35932a6e48fSopenharmony_ci} OHHDRMetaData;
36032a6e48fSopenharmony_ci
36132a6e48fSopenharmony_ci/**
36232a6e48fSopenharmony_ci * @brief Defines the ExtData Handle
36332a6e48fSopenharmony_ci * @since 9
36432a6e48fSopenharmony_ci * @deprecated(since = "10")
36532a6e48fSopenharmony_ci */
36632a6e48fSopenharmony_citypedef struct OHExtDataHandle {
36732a6e48fSopenharmony_ci    /**< Handle fd, -1 if not supported */
36832a6e48fSopenharmony_ci    int32_t fd;
36932a6e48fSopenharmony_ci    /**< the number of reserved integer value */
37032a6e48fSopenharmony_ci    uint32_t reserveInts;
37132a6e48fSopenharmony_ci    /**< the reserved data */
37232a6e48fSopenharmony_ci    int32_t reserve[0];
37332a6e48fSopenharmony_ci} OHExtDataHandle;
37432a6e48fSopenharmony_ci
37532a6e48fSopenharmony_ci/**
37632a6e48fSopenharmony_ci * @brief Indicates the source type of surface.
37732a6e48fSopenharmony_ci * @since 12
37832a6e48fSopenharmony_ci */
37932a6e48fSopenharmony_citypedef enum {
38032a6e48fSopenharmony_ci    /*
38132a6e48fSopenharmony_ci     * the default source type of surface.
38232a6e48fSopenharmony_ci     */
38332a6e48fSopenharmony_ci    OH_SURFACE_SOURCE_DEFAULT = 0,
38432a6e48fSopenharmony_ci    /*
38532a6e48fSopenharmony_ci     * the surface is created by ui.
38632a6e48fSopenharmony_ci     */
38732a6e48fSopenharmony_ci    OH_SURFACE_SOURCE_UI,
38832a6e48fSopenharmony_ci    /*
38932a6e48fSopenharmony_ci     * the surface is created by game.
39032a6e48fSopenharmony_ci     */
39132a6e48fSopenharmony_ci    OH_SURFACE_SOURCE_GAME,
39232a6e48fSopenharmony_ci    /*
39332a6e48fSopenharmony_ci     * the surface is created by camera.
39432a6e48fSopenharmony_ci     */
39532a6e48fSopenharmony_ci    OH_SURFACE_SOURCE_CAMERA,
39632a6e48fSopenharmony_ci    /*
39732a6e48fSopenharmony_ci     * the surface is created by video.
39832a6e48fSopenharmony_ci     */
39932a6e48fSopenharmony_ci    OH_SURFACE_SOURCE_VIDEO,
40032a6e48fSopenharmony_ci} OHSurfaceSource;
40132a6e48fSopenharmony_ci
40232a6e48fSopenharmony_ci/**
40332a6e48fSopenharmony_ci * @brief Creates an <b>OHNativeWindow</b> instance.
40432a6e48fSopenharmony_ci * A new <b>OHNativeWindow</b> instance is created each time this function is called.\n
40532a6e48fSopenharmony_ci *
40632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
40732a6e48fSopenharmony_ci * @param pSurface Indicates the pointer to a <b>ProduceSurface</b>.
40832a6e48fSopenharmony_ci * The type is a pointer to <b>sptr<OHOS::Surface></b>.
40932a6e48fSopenharmony_ci * @return Returns the pointer to the <b>OHNativeWindow</b> instance created.
41032a6e48fSopenharmony_ci * @since 8
41132a6e48fSopenharmony_ci * @version 1.0
41232a6e48fSopenharmony_ci * @deprecated since 12
41332a6e48fSopenharmony_ci */
41432a6e48fSopenharmony_ciOHNativeWindow* OH_NativeWindow_CreateNativeWindow(void* pSurface);
41532a6e48fSopenharmony_ci
41632a6e48fSopenharmony_ci/**
41732a6e48fSopenharmony_ci * @brief Decreases the reference count of an <b>OHNativeWindow</b> instance by 1, and when the reference count \n
41832a6e48fSopenharmony_ci * reaches 0, destroys the instance.
41932a6e48fSopenharmony_ci *
42032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
42132a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
42232a6e48fSopenharmony_ci * @since 8
42332a6e48fSopenharmony_ci * @version 1.0
42432a6e48fSopenharmony_ci */
42532a6e48fSopenharmony_civoid OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window);
42632a6e48fSopenharmony_ci
42732a6e48fSopenharmony_ci/**
42832a6e48fSopenharmony_ci * @brief Creates an <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created \n
42932a6e48fSopenharmony_ci * each time this function is called.
43032a6e48fSopenharmony_ci *
43132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
43232a6e48fSopenharmony_ci * @param pSurfaceBuffer Indicates the pointer to a produce buffer. The type is <b>sptr<OHOS::SurfaceBuffer></b>.
43332a6e48fSopenharmony_ci * @return Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
43432a6e48fSopenharmony_ci * @since 8
43532a6e48fSopenharmony_ci * @version 1.0
43632a6e48fSopenharmony_ci * @deprecated since 12
43732a6e48fSopenharmony_ci * @useinstead OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer
43832a6e48fSopenharmony_ci */
43932a6e48fSopenharmony_ciOHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer);
44032a6e48fSopenharmony_ci
44132a6e48fSopenharmony_ci/**
44232a6e48fSopenharmony_ci * @brief Creates an <b>OHNativeWindowBuffer</b> instance. A new <b>OHNativeWindowBuffer</b> instance is created \n
44332a6e48fSopenharmony_ci * each time this function is called.
44432a6e48fSopenharmony_ci *
44532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
44632a6e48fSopenharmony_ci * @param nativeBuffer Indicates the pointer to a native buffer. The type is <b>OH_NativeBuffer*</b>.
44732a6e48fSopenharmony_ci * @return Returns the pointer to the <b>OHNativeWindowBuffer</b> instance created.
44832a6e48fSopenharmony_ci * @since 11
44932a6e48fSopenharmony_ci * @version 1.0
45032a6e48fSopenharmony_ci */
45132a6e48fSopenharmony_ciOHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer);
45232a6e48fSopenharmony_ci
45332a6e48fSopenharmony_ci/**
45432a6e48fSopenharmony_ci * @brief Decreases the reference count of an <b>OHNativeWindowBuffer</b> instance by 1 and, when the reference \n
45532a6e48fSopenharmony_ci * count reaches 0, destroys the instance.
45632a6e48fSopenharmony_ci *
45732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
45832a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
45932a6e48fSopenharmony_ci * @since 8
46032a6e48fSopenharmony_ci * @version 1.0
46132a6e48fSopenharmony_ci */
46232a6e48fSopenharmony_civoid OH_NativeWindow_DestroyNativeWindowBuffer(OHNativeWindowBuffer* buffer);
46332a6e48fSopenharmony_ci
46432a6e48fSopenharmony_ci/**
46532a6e48fSopenharmony_ci * @brief Requests an <b>OHNativeWindowBuffer</b> through an <b>OHNativeWindow</b> instance for content production.
46632a6e48fSopenharmony_ci *
46732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
46832a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
46932a6e48fSopenharmony_ci * @param buffer Indicates the double pointer to an <b>OHNativeWindowBuffer</b> instance.
47032a6e48fSopenharmony_ci * @param fenceFd Indicates the pointer to a file descriptor handle.
47132a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
47232a6e48fSopenharmony_ci * @since 8
47332a6e48fSopenharmony_ci * @version 1.0
47432a6e48fSopenharmony_ci */
47532a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window,
47632a6e48fSopenharmony_ci    OHNativeWindowBuffer **buffer, int *fenceFd);
47732a6e48fSopenharmony_ci
47832a6e48fSopenharmony_ci/**
47932a6e48fSopenharmony_ci * @brief Flushes the <b>OHNativeWindowBuffer</b> filled with the content to the buffer queue through an \n
48032a6e48fSopenharmony_ci * <b>OHNativeWindow</b> instance for content consumption.
48132a6e48fSopenharmony_ci *
48232a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
48332a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
48432a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
48532a6e48fSopenharmony_ci * @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.
48632a6e48fSopenharmony_ci * @param region Indicates a dirty region where content is updated.
48732a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
48832a6e48fSopenharmony_ci * @since 8
48932a6e48fSopenharmony_ci * @version 1.0
49032a6e48fSopenharmony_ci */
49132a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer,
49232a6e48fSopenharmony_ci    int fenceFd, Region region);
49332a6e48fSopenharmony_ci
49432a6e48fSopenharmony_ci/**
49532a6e48fSopenharmony_ci * @brief Get the last flushed <b>OHNativeWindowBuffer</b> from an <b>OHNativeWindow</b> instance.
49632a6e48fSopenharmony_ci *
49732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
49832a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
49932a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.
50032a6e48fSopenharmony_ci * @param fenceFd Indicates the pointer to a file descriptor handle.
50132a6e48fSopenharmony_ci * @param matrix Indicates the retrieved 4*4 transform matrix.
50232a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
50332a6e48fSopenharmony_ci * @since 11
50432a6e48fSopenharmony_ci * @version 1.0
50532a6e48fSopenharmony_ci * @deprecated since 12
50632a6e48fSopenharmony_ci * @useinstead OH_NativeWindow_GetLastFlushedBufferV2
50732a6e48fSopenharmony_ci */
50832a6e48fSopenharmony_ciint32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer,
50932a6e48fSopenharmony_ci    int *fenceFd, float matrix[16]);
51032a6e48fSopenharmony_ci
51132a6e48fSopenharmony_ci /**
51232a6e48fSopenharmony_ci * @brief Returns the <b>OHNativeWindowBuffer</b> to the buffer queue through an <b>OHNativeWindow</b> instance, \n
51332a6e48fSopenharmony_ci * without filling in any content. The <b>OHNativeWindowBuffer</b> can be used for another request.
51432a6e48fSopenharmony_ci *
51532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
51632a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
51732a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
51832a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
51932a6e48fSopenharmony_ci * @since 8
52032a6e48fSopenharmony_ci * @version 1.0
52132a6e48fSopenharmony_ci */
52232a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowAbortBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
52332a6e48fSopenharmony_ci
52432a6e48fSopenharmony_ci/**
52532a6e48fSopenharmony_ci * @brief Sets or obtains the attributes of a native window, including the width, height, and content format.
52632a6e48fSopenharmony_ci *
52732a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
52832a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
52932a6e48fSopenharmony_ci * @param code Indicates the operation code, pointer to <b>NativeWindowOperation</b>.
53032a6e48fSopenharmony_ci * @param ... variable parameter, must correspond to code one-to-one.
53132a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
53232a6e48fSopenharmony_ci * @since 8
53332a6e48fSopenharmony_ci * @version 1.0
53432a6e48fSopenharmony_ci */
53532a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowHandleOpt(OHNativeWindow *window, int code, ...);
53632a6e48fSopenharmony_ci
53732a6e48fSopenharmony_ci/**
53832a6e48fSopenharmony_ci * @brief Obtains the pointer to a <b>BufferHandle</b> of an <b>OHNativeWindowBuffer</b> instance.
53932a6e48fSopenharmony_ci *
54032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
54132a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
54232a6e48fSopenharmony_ci * @return Returns the pointer to the <b>BufferHandle</b> instance obtained.
54332a6e48fSopenharmony_ci * @since 8
54432a6e48fSopenharmony_ci * @version 1.0
54532a6e48fSopenharmony_ci */
54632a6e48fSopenharmony_ciBufferHandle *OH_NativeWindow_GetBufferHandleFromNative(OHNativeWindowBuffer *buffer);
54732a6e48fSopenharmony_ci
54832a6e48fSopenharmony_ci/**
54932a6e48fSopenharmony_ci * @brief Adds the reference count of a native object.
55032a6e48fSopenharmony_ci *
55132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
55232a6e48fSopenharmony_ci * @param obj Indicates the pointer to an <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
55332a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
55432a6e48fSopenharmony_ci * @since 8
55532a6e48fSopenharmony_ci * @version 1.0
55632a6e48fSopenharmony_ci */
55732a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeObjectReference(void *obj);
55832a6e48fSopenharmony_ci
55932a6e48fSopenharmony_ci/**
56032a6e48fSopenharmony_ci * @brief Decreases the reference count of a native object and, when the reference count reaches 0, \n
56132a6e48fSopenharmony_ci * destroys this object.
56232a6e48fSopenharmony_ci *
56332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
56432a6e48fSopenharmony_ci * @param obj Indicates the pointer to an <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
56532a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
56632a6e48fSopenharmony_ci * @since 8
56732a6e48fSopenharmony_ci * @version 1.0
56832a6e48fSopenharmony_ci */
56932a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeObjectUnreference(void *obj);
57032a6e48fSopenharmony_ci
57132a6e48fSopenharmony_ci/**
57232a6e48fSopenharmony_ci * @brief Obtains the magic ID of a native object.
57332a6e48fSopenharmony_ci *
57432a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
57532a6e48fSopenharmony_ci * @param obj Indicates the pointer to an <b>OHNativeWindow</b> or <b>OHNativeWindowBuffer</b> instance.
57632a6e48fSopenharmony_ci * @return Returns the magic ID, which is unique for each native object.
57732a6e48fSopenharmony_ci * @since 8
57832a6e48fSopenharmony_ci * @version 1.0
57932a6e48fSopenharmony_ci */
58032a6e48fSopenharmony_ciint32_t OH_NativeWindow_GetNativeObjectMagic(void *obj);
58132a6e48fSopenharmony_ci
58232a6e48fSopenharmony_ci/**
58332a6e48fSopenharmony_ci * @brief Sets scalingMode of a native window.
58432a6e48fSopenharmony_ci *
58532a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
58632a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
58732a6e48fSopenharmony_ci * @param sequence Indicates the sequence to a produce buffer.
58832a6e48fSopenharmony_ci * @param scalingMode Indicates the enum value to <b>OHScalingMode</b>
58932a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
59032a6e48fSopenharmony_ci * @since 9
59132a6e48fSopenharmony_ci * @version 1.0
59232a6e48fSopenharmony_ci * @deprecated(since = "10")
59332a6e48fSopenharmony_ci */
59432a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence,
59532a6e48fSopenharmony_ci                                                   OHScalingMode scalingMode);
59632a6e48fSopenharmony_ci
59732a6e48fSopenharmony_ci/**
59832a6e48fSopenharmony_ci * @brief Sets metaData of a native window.
59932a6e48fSopenharmony_ci *
60032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
60132a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
60232a6e48fSopenharmony_ci * @param sequence Indicates the sequence to a produce buffer.
60332a6e48fSopenharmony_ci * @param size Indicates the size of a <b>OHHDRMetaData</b> vector.
60432a6e48fSopenharmony_ci * @param metaDate Indicates the pointer to a <b>OHHDRMetaData</b> vector.
60532a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
60632a6e48fSopenharmony_ci * @since 9
60732a6e48fSopenharmony_ci * @version 1.0
60832a6e48fSopenharmony_ci * @deprecated(since = "10")
60932a6e48fSopenharmony_ci */
61032a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t sequence, int32_t size,
61132a6e48fSopenharmony_ci                                                const OHHDRMetaData *metaData);
61232a6e48fSopenharmony_ci
61332a6e48fSopenharmony_ci/**
61432a6e48fSopenharmony_ci * @brief Sets metaDataSet of a native window.
61532a6e48fSopenharmony_ci *
61632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
61732a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
61832a6e48fSopenharmony_ci * @param sequence Indicates the sequence to a produce buffer.
61932a6e48fSopenharmony_ci * @param key Indicates the enum value to <b>OHHDRMetadataKey</b>
62032a6e48fSopenharmony_ci * @param size Indicates the size of a uint8_t vector.
62132a6e48fSopenharmony_ci * @param metaDate Indicates the pointer to a uint8_t vector.
62232a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
62332a6e48fSopenharmony_ci * @since 9
62432a6e48fSopenharmony_ci * @version 1.0
62532a6e48fSopenharmony_ci * @deprecated(since = "10")
62632a6e48fSopenharmony_ci */
62732a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key,
62832a6e48fSopenharmony_ci                                                   int32_t size, const uint8_t *metaData);
62932a6e48fSopenharmony_ci
63032a6e48fSopenharmony_ci/**
63132a6e48fSopenharmony_ci * @brief Sets tunnel handle of a native window.
63232a6e48fSopenharmony_ci *
63332a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
63432a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
63532a6e48fSopenharmony_ci * @param handle Indicates the pointer to a <b>OHExtDataHandle</b>.
63632a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
63732a6e48fSopenharmony_ci * @since 9
63832a6e48fSopenharmony_ci * @version 1.0
63932a6e48fSopenharmony_ci * @deprecated(since = "10")
64032a6e48fSopenharmony_ci */
64132a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle);
64232a6e48fSopenharmony_ci
64332a6e48fSopenharmony_ci/**
64432a6e48fSopenharmony_ci * @brief Get surfaceId from native window.
64532a6e48fSopenharmony_ci *
64632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
64732a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
64832a6e48fSopenharmony_ci * @param surfaceId Indicates the pointer to a surfaceId.
64932a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
65032a6e48fSopenharmony_ci * @since 12
65132a6e48fSopenharmony_ci * @version 1.0
65232a6e48fSopenharmony_ci */
65332a6e48fSopenharmony_ciint32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId);
65432a6e48fSopenharmony_ci
65532a6e48fSopenharmony_ci/**
65632a6e48fSopenharmony_ci * @brief Creates an <b>OHNativeWindow</b> instance.\n
65732a6e48fSopenharmony_ci *
65832a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
65932a6e48fSopenharmony_ci * @param surfaceId Indicates the surfaceId to a surface.
66032a6e48fSopenharmony_ci * @param window indicates the pointer to an <b>OHNativeWindow</b> instance.
66132a6e48fSopenharmony_ci * @return Returns an error code, 0 is Success, otherwise, failed.
66232a6e48fSopenharmony_ci * @since 12
66332a6e48fSopenharmony_ci * @version 1.0
66432a6e48fSopenharmony_ci */
66532a6e48fSopenharmony_ciint32_t OH_NativeWindow_CreateNativeWindowFromSurfaceId(uint64_t surfaceId, OHNativeWindow **window);
66632a6e48fSopenharmony_ci
66732a6e48fSopenharmony_ci/**
66832a6e48fSopenharmony_ci * @brief Attach a buffer to an <b>OHNativeWindow</b> instance.
66932a6e48fSopenharmony_ci *
67032a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
67132a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
67232a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
67332a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
67432a6e48fSopenharmony_ci * @since 12
67532a6e48fSopenharmony_ci * @version 1.0
67632a6e48fSopenharmony_ci */
67732a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowAttachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
67832a6e48fSopenharmony_ci
67932a6e48fSopenharmony_ci/**
68032a6e48fSopenharmony_ci * @brief Detach a buffer from an <b>OHNativeWindow</b> instance.
68132a6e48fSopenharmony_ci *
68232a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
68332a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
68432a6e48fSopenharmony_ci * @param buffer Indicates the pointer to a <b>OHNativeWindowBuffer</b> instance.
68532a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
68632a6e48fSopenharmony_ci * @since 12
68732a6e48fSopenharmony_ci * @version 1.0
68832a6e48fSopenharmony_ci */
68932a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowDetachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
69032a6e48fSopenharmony_ci
69132a6e48fSopenharmony_ci/**
69232a6e48fSopenharmony_ci * @brief Sets scalingMode of a native window.
69332a6e48fSopenharmony_ci *
69432a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
69532a6e48fSopenharmony_ci * @param window indicates the pointer to an <b>OHNativeWindow</b> instance.
69632a6e48fSopenharmony_ci * @param scalingMode Indicates the enum value to <b>OHScalingModeV2</b>
69732a6e48fSopenharmony_ci * @return Returns an error code, 0 is Success, otherwise, failed.
69832a6e48fSopenharmony_ci * @since 12
69932a6e48fSopenharmony_ci * @version 1.0
70032a6e48fSopenharmony_ci */
70132a6e48fSopenharmony_ciint32_t OH_NativeWindow_NativeWindowSetScalingModeV2(OHNativeWindow *window, OHScalingModeV2 scalingMode);
70232a6e48fSopenharmony_ci
70332a6e48fSopenharmony_ci/**
70432a6e48fSopenharmony_ci * @brief Set native window buffer hold.
70532a6e48fSopenharmony_ci *
70632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
70732a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
70832a6e48fSopenharmony_ci * @since 12
70932a6e48fSopenharmony_ci * @version 1.0
71032a6e48fSopenharmony_ci */
71132a6e48fSopenharmony_civoid OH_NativeWindow_SetBufferHold(OHNativeWindow *window);
71232a6e48fSopenharmony_ci
71332a6e48fSopenharmony_ci/**
71432a6e48fSopenharmony_ci * @brief Write an OHNativeWindow to an OHIPCParcel.
71532a6e48fSopenharmony_ci *
71632a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
71732a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
71832a6e48fSopenharmony_ci * @param parcel Indicates the pointer to an <b>OHIPCParcel</b> instance.
71932a6e48fSopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
72032a6e48fSopenharmony_ci * @since 12
72132a6e48fSopenharmony_ci * @version 1.0
72232a6e48fSopenharmony_ci */
72332a6e48fSopenharmony_ciint32_t OH_NativeWindow_WriteToParcel(OHNativeWindow *window, OHIPCParcel *parcel);
72432a6e48fSopenharmony_ci
72532a6e48fSopenharmony_ci/**
72632a6e48fSopenharmony_ci * @brief Read an OHNativeWindow from an OHIPCParcel.
72732a6e48fSopenharmony_ci *
72832a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
72932a6e48fSopenharmony_ci * @param parcel Indicates the pointer to an <b>OHIPCParcel</b> instance.
73032a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
73132a6e48fSopenharmony_ci * @return 0 - Success.
73232a6e48fSopenharmony_ci *     40001000 - parcel is NULL or parcel does not contain the window.
73332a6e48fSopenharmony_ci * @since 12
73432a6e48fSopenharmony_ci * @version 1.0
73532a6e48fSopenharmony_ci */
73632a6e48fSopenharmony_ciint32_t OH_NativeWindow_ReadFromParcel(OHIPCParcel *parcel, OHNativeWindow **window);
73732a6e48fSopenharmony_ci
73832a6e48fSopenharmony_ci/**
73932a6e48fSopenharmony_ci * @brief Get the last flushed <b>OHNativeWindowBuffer</b> from an <b>OHNativeWindow</b> instance.
74032a6e48fSopenharmony_ci *
74132a6e48fSopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
74232a6e48fSopenharmony_ci * @param window Indicates the pointer to an <b>OHNativeWindow</b> instance.
74332a6e48fSopenharmony_ci * @param buffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> pointer.
74432a6e48fSopenharmony_ci * @param fenceFd Indicates the pointer to a file descriptor handle.
74532a6e48fSopenharmony_ci * @param matrix Indicates the retrieved 4*4 transform matrix.
74632a6e48fSopenharmony_ci * @return 0 - Success.
74732a6e48fSopenharmony_ci *     40001000 - window is NULL or buffer is NULL or fenceFd is NULL.
74832a6e48fSopenharmony_ci *     41207000 - buffer state is wrong.
74932a6e48fSopenharmony_ci * @since 12
75032a6e48fSopenharmony_ci * @version 1.0
75132a6e48fSopenharmony_ci */
75232a6e48fSopenharmony_ciint32_t OH_NativeWindow_GetLastFlushedBufferV2(OHNativeWindow *window, OHNativeWindowBuffer **buffer,
75332a6e48fSopenharmony_ci    int *fenceFd, float matrix[16]);
75432a6e48fSopenharmony_ci
75532a6e48fSopenharmony_ci#ifdef __cplusplus
75632a6e48fSopenharmony_ci}
75732a6e48fSopenharmony_ci#endif
75832a6e48fSopenharmony_ci
75932a6e48fSopenharmony_ci/** @} */
76032a6e48fSopenharmony_ci#endif