17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci#ifndef NDK_INCLUDE_NATIVE_IMAGE_H_
177777dab0Sopenharmony_ci#define NDK_INCLUDE_NATIVE_IMAGE_H_
187777dab0Sopenharmony_ci
197777dab0Sopenharmony_ci/**
207777dab0Sopenharmony_ci * @addtogroup OH_NativeImage
217777dab0Sopenharmony_ci * @{
227777dab0Sopenharmony_ci *
237777dab0Sopenharmony_ci * @brief Provides the native image capability.
247777dab0Sopenharmony_ci *
257777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
267777dab0Sopenharmony_ci * @since 9
277777dab0Sopenharmony_ci * @version 1.0
287777dab0Sopenharmony_ci */
297777dab0Sopenharmony_ci
307777dab0Sopenharmony_ci/**
317777dab0Sopenharmony_ci * @file native_image.h
327777dab0Sopenharmony_ci *
337777dab0Sopenharmony_ci * @brief Defines the functions for obtaining and using a native image.
347777dab0Sopenharmony_ci *
357777dab0Sopenharmony_ci * @kit ArkGraphics2D
367777dab0Sopenharmony_ci * @library libnative_image.so
377777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
387777dab0Sopenharmony_ci * @since 9
397777dab0Sopenharmony_ci * @version 1.0
407777dab0Sopenharmony_ci */
417777dab0Sopenharmony_ci
427777dab0Sopenharmony_ci#include <stdint.h>
437777dab0Sopenharmony_ci
447777dab0Sopenharmony_ci#ifdef __cplusplus
457777dab0Sopenharmony_ciextern "C" {
467777dab0Sopenharmony_ci#endif
477777dab0Sopenharmony_ci
487777dab0Sopenharmony_cistruct OH_NativeImage;
497777dab0Sopenharmony_citypedef struct OH_NativeImage OH_NativeImage;
507777dab0Sopenharmony_citypedef struct NativeWindow OHNativeWindow;
517777dab0Sopenharmony_ci/**
527777dab0Sopenharmony_ci * @brief define the new type name OHNativeWindowBuffer for struct NativeWindowBuffer.
537777dab0Sopenharmony_ci * @since 12
547777dab0Sopenharmony_ci */
557777dab0Sopenharmony_citypedef struct NativeWindowBuffer OHNativeWindowBuffer;
567777dab0Sopenharmony_ci/**
577777dab0Sopenharmony_ci * @brief The callback function of frame available.
587777dab0Sopenharmony_ci *
597777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
607777dab0Sopenharmony_ci * @param context User defined context, returned to the user in the callback function
617777dab0Sopenharmony_ci * @since 11
627777dab0Sopenharmony_ci * @version 1.0
637777dab0Sopenharmony_ci */
647777dab0Sopenharmony_citypedef void (*OH_OnFrameAvailable)(void *context);
657777dab0Sopenharmony_ci
667777dab0Sopenharmony_ci/**
677777dab0Sopenharmony_ci * @brief A listener for native image, use <b>OH_NativeImage_SetOnFrameAvailableListener</b> to register \n
687777dab0Sopenharmony_ci * the listener object to <b>OH_NativeImage</b>, the callback will be triggered when there is available frame
697777dab0Sopenharmony_ci *
707777dab0Sopenharmony_ci * @since 11
717777dab0Sopenharmony_ci * @version 1.0
727777dab0Sopenharmony_ci */
737777dab0Sopenharmony_citypedef struct OH_OnFrameAvailableListener {
747777dab0Sopenharmony_ci    /** User defined context, returned to the user in the callback function*/
757777dab0Sopenharmony_ci    void *context;
767777dab0Sopenharmony_ci    /** The callback function of frame available.*/
777777dab0Sopenharmony_ci    OH_OnFrameAvailable onFrameAvailable;
787777dab0Sopenharmony_ci} OH_OnFrameAvailableListener;
797777dab0Sopenharmony_ci
807777dab0Sopenharmony_ci/**
817777dab0Sopenharmony_ci * @brief Create a <b>OH_NativeImage</b> related to an Opengl ES texture and target. \n
827777dab0Sopenharmony_ci * This interface needs to be used in conjunction with <b>OH_NativeImage_Destroy<\b>,
837777dab0Sopenharmony_ci * otherwise memory leaks will occur.\n
847777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
857777dab0Sopenharmony_ci *
867777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
877777dab0Sopenharmony_ci * @param textureId Indicates the id of the Opengl ES texture which the native image attached to.
887777dab0Sopenharmony_ci * @param textureTarget Indicates the Opengl ES target.
897777dab0Sopenharmony_ci * @return Returns the pointer to the <b>OH_NativeImage</b> instance created if the operation is successful, \n
907777dab0Sopenharmony_ci * returns <b>NULL</b> otherwise.
917777dab0Sopenharmony_ci * @since 9
927777dab0Sopenharmony_ci * @version 1.0
937777dab0Sopenharmony_ci */
947777dab0Sopenharmony_ciOH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget);
957777dab0Sopenharmony_ci
967777dab0Sopenharmony_ci/**
977777dab0Sopenharmony_ci * @brief Acquire the OHNativeWindow for the OH_NativeImage.\n
987777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
997777dab0Sopenharmony_ci *
1007777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1017777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1027777dab0Sopenharmony_ci * @return Returns the pointer to the OHNativeWindow if the operation is successful, returns <b>NULL</b> otherwise.
1037777dab0Sopenharmony_ci * @since 9
1047777dab0Sopenharmony_ci * @version 1.0
1057777dab0Sopenharmony_ci */
1067777dab0Sopenharmony_ciOHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image);
1077777dab0Sopenharmony_ci
1087777dab0Sopenharmony_ci/**
1097777dab0Sopenharmony_ci * @brief Attach the OH_NativeImage to Opengl ES context, and the Opengl ES texture is bound to the \n
1107777dab0Sopenharmony_ci * GL_TEXTURE_EXTERNAL_OES, which will update by the OH_NativeImage.\n
1117777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1127777dab0Sopenharmony_ci *
1137777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1147777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1157777dab0Sopenharmony_ci * @param textureId Indicates the id of the Opengl ES texture which the native image attached to.
1167777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1177777dab0Sopenharmony_ci * @since 9
1187777dab0Sopenharmony_ci * @version 1.0
1197777dab0Sopenharmony_ci */
1207777dab0Sopenharmony_ciint32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId);
1217777dab0Sopenharmony_ci
1227777dab0Sopenharmony_ci/**
1237777dab0Sopenharmony_ci * @brief Detach the OH_NativeImage from the Opengl ES context.\n
1247777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1257777dab0Sopenharmony_ci *
1267777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1277777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1287777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1297777dab0Sopenharmony_ci * @since 9
1307777dab0Sopenharmony_ci * @version 1.0
1317777dab0Sopenharmony_ci */
1327777dab0Sopenharmony_ci
1337777dab0Sopenharmony_ciint32_t OH_NativeImage_DetachContext(OH_NativeImage* image);
1347777dab0Sopenharmony_ci
1357777dab0Sopenharmony_ci/**
1367777dab0Sopenharmony_ci * @brief Update the related Opengl ES texture with the OH_NativeImage acquired buffer.\n
1377777dab0Sopenharmony_ci * This interface needs to be called in the Opengl ES context thread.\n
1387777dab0Sopenharmony_ci * This interface needs to be called after receiving the <b>OH_OnFrameAvailableListener<\b> callback.\n
1397777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1407777dab0Sopenharmony_ci *
1417777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1427777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1437777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1447777dab0Sopenharmony_ci * @since 9
1457777dab0Sopenharmony_ci * @version 1.0
1467777dab0Sopenharmony_ci */
1477777dab0Sopenharmony_ciint32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image);
1487777dab0Sopenharmony_ci
1497777dab0Sopenharmony_ci/**
1507777dab0Sopenharmony_ci * @brief Get the timestamp of the texture image set by the most recent call to OH_NativeImage_UpdateSurfaceImage.\n
1517777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1527777dab0Sopenharmony_ci *
1537777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1547777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1557777dab0Sopenharmony_ci * @return Returns the timestamp associated to the texture image.
1567777dab0Sopenharmony_ci * @since 9
1577777dab0Sopenharmony_ci * @version 1.0
1587777dab0Sopenharmony_ci */
1597777dab0Sopenharmony_ciint64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image);
1607777dab0Sopenharmony_ci
1617777dab0Sopenharmony_ci/**
1627777dab0Sopenharmony_ci * @brief Return the transform matrix of the texture image set by the most recent call to \n
1637777dab0Sopenharmony_ci * OH_NativeImage_UpdateSurfaceImage.
1647777dab0Sopenharmony_ci *
1657777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1667777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1677777dab0Sopenharmony_ci * @param matrix Indicates the retrieved 4*4 transform matrix .
1687777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1697777dab0Sopenharmony_ci * @since 9
1707777dab0Sopenharmony_ci * @version 1.0
1717777dab0Sopenharmony_ci * @deprecated since 12
1727777dab0Sopenharmony_ci * @useinstead OH_NativeImage_GetTransformMatrixV2
1737777dab0Sopenharmony_ci */
1747777dab0Sopenharmony_ciint32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]);
1757777dab0Sopenharmony_ci
1767777dab0Sopenharmony_ci/**
1777777dab0Sopenharmony_ci * @brief Return the native image's surface id.\n
1787777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1797777dab0Sopenharmony_ci *
1807777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1817777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1827777dab0Sopenharmony_ci * @param surfaceId Indicates the surface id.
1837777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1847777dab0Sopenharmony_ci * @since 11
1857777dab0Sopenharmony_ci * @version 1.0
1867777dab0Sopenharmony_ci */
1877777dab0Sopenharmony_ciint32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId);
1887777dab0Sopenharmony_ci
1897777dab0Sopenharmony_ci/**
1907777dab0Sopenharmony_ci * @brief Set the frame available callback.\n
1917777dab0Sopenharmony_ci * Not allow calling other interfaces in the callback function.\n
1927777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
1937777dab0Sopenharmony_ci *
1947777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
1957777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
1967777dab0Sopenharmony_ci * @param listener Indicates the callback function.
1977777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
1987777dab0Sopenharmony_ci * @since 11
1997777dab0Sopenharmony_ci * @version 1.0
2007777dab0Sopenharmony_ci */
2017777dab0Sopenharmony_ciint32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener);
2027777dab0Sopenharmony_ci
2037777dab0Sopenharmony_ci/**
2047777dab0Sopenharmony_ci * @brief Unset the frame available callback.\n
2057777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2067777dab0Sopenharmony_ci *
2077777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
2087777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
2097777dab0Sopenharmony_ci * @return Returns an error code, 0 is success, otherwise, failed.
2107777dab0Sopenharmony_ci * @since 11
2117777dab0Sopenharmony_ci * @version 1.0
2127777dab0Sopenharmony_ci */
2137777dab0Sopenharmony_ciint32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image);
2147777dab0Sopenharmony_ci
2157777dab0Sopenharmony_ci/**
2167777dab0Sopenharmony_ci * @brief Destroy the <b>OH_NativeImage</b> created by OH_NativeImage_Create, and the pointer to
2177777dab0Sopenharmony_ci * <b>OH_NativeImage</b> will be null after this operation.\n
2187777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2197777dab0Sopenharmony_ci *
2207777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
2217777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> pointer.
2227777dab0Sopenharmony_ci * @since 9
2237777dab0Sopenharmony_ci * @version 1.0
2247777dab0Sopenharmony_ci */
2257777dab0Sopenharmony_civoid OH_NativeImage_Destroy(OH_NativeImage** image);
2267777dab0Sopenharmony_ci
2277777dab0Sopenharmony_ci/**
2287777dab0Sopenharmony_ci * @brief Obtains the transform matrix of the texture image by producer transform type.\n
2297777dab0Sopenharmony_ci * The matrix will not be update until <b>OH_NativeImage_UpdateSurfaceImage<\b> is called.\n
2307777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2317777dab0Sopenharmony_ci *
2327777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
2337777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
2347777dab0Sopenharmony_ci * @param matrix Indicates the retrieved 4*4 transform matrix .
2357777dab0Sopenharmony_ci * @return 0 - Success.
2367777dab0Sopenharmony_ci *     40001000 - image is NULL.
2377777dab0Sopenharmony_ci * @since 12
2387777dab0Sopenharmony_ci * @version 1.0
2397777dab0Sopenharmony_ci */
2407777dab0Sopenharmony_ciint32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[16]);
2417777dab0Sopenharmony_ci
2427777dab0Sopenharmony_ci/**
2437777dab0Sopenharmony_ci * @brief Acquire an <b>OHNativeWindowBuffer</b> through an <b>OH_NativeImage</b> instance for content consumer.\n
2447777dab0Sopenharmony_ci * This method can not be used at the same time with <b>OH_NativeImage_UpdateSurfaceImage</b>.\n
2457777dab0Sopenharmony_ci * This method will create an <b>OHNativeWindowBuffer</b>.\n
2467777dab0Sopenharmony_ci * When using <b>OHNativeWindowBuffer</b>, need to increase its reference count
2477777dab0Sopenharmony_ci * by <b>OH_NativeWindow_NativeObjectReference</b>.\n
2487777dab0Sopenharmony_ci * When the <b>OHNativeWindowBuffer</b> is used up, its reference count needs to be decremented
2497777dab0Sopenharmony_ci * by <b>OH_NativeWindow_NativeObjectUnreference</b>.\n
2507777dab0Sopenharmony_ci * This interface needs to be used in conjunction with <b>OH_NativeImage_ReleaseNativeWindowBuffer<\b>,
2517777dab0Sopenharmony_ci * otherwise memory leaks will occur.\n
2527777dab0Sopenharmony_ci * When the fenceFd is used up, you need to close it.\n
2537777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2547777dab0Sopenharmony_ci *
2557777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
2567777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
2577777dab0Sopenharmony_ci * @param nativeWindowBuffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> point.
2587777dab0Sopenharmony_ci * @param fenceFd Indicates the pointer to a file descriptor handle.
2597777dab0Sopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success.
2607777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image, nativeWindowBuffer, fenceFd is NULL.
2617777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_NO_BUFFER} 40601000 - No buffer for consume.
2627777dab0Sopenharmony_ci * @since 12
2637777dab0Sopenharmony_ci * @version 1.0
2647777dab0Sopenharmony_ci */
2657777dab0Sopenharmony_ciint32_t OH_NativeImage_AcquireNativeWindowBuffer(OH_NativeImage* image,
2667777dab0Sopenharmony_ci    OHNativeWindowBuffer** nativeWindowBuffer, int* fenceFd);
2677777dab0Sopenharmony_ci
2687777dab0Sopenharmony_ci/**
2697777dab0Sopenharmony_ci * @brief Release the <b>OHNativeWindowBuffer</b> to the buffer queue through an
2707777dab0Sopenharmony_ci * <b>OH_NativeImage</b> instance for reuse.\n
2717777dab0Sopenharmony_ci * The fenceFd will be close by system.\n
2727777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2737777dab0Sopenharmony_ci *
2747777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
2757777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
2767777dab0Sopenharmony_ci * @param nativeWindowBuffer Indicates the pointer to an <b>OHNativeWindowBuffer</b> instance.
2777777dab0Sopenharmony_ci * @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.
2787777dab0Sopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success.
2797777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image, nativeWindowBuffer is NULL.
2807777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_BUFFER_STATE_INVALID} 41207000 - nativeWindowBuffer state invalid.
2817777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_BUFFER_NOT_IN_CACHE} 41210000 - nativeWindowBuffer not in cache.
2827777dab0Sopenharmony_ci * @since 12
2837777dab0Sopenharmony_ci * @version 1.0
2847777dab0Sopenharmony_ci */
2857777dab0Sopenharmony_ciint32_t OH_NativeImage_ReleaseNativeWindowBuffer(OH_NativeImage* image,
2867777dab0Sopenharmony_ci    OHNativeWindowBuffer* nativeWindowBuffer, int fenceFd);
2877777dab0Sopenharmony_ci
2887777dab0Sopenharmony_ci/**
2897777dab0Sopenharmony_ci * @brief Create a <b>OH_NativeImage</b> as a consumerSurface. \n
2907777dab0Sopenharmony_ci * This interface is only used for memory rotation on the surface consumer,
2917777dab0Sopenharmony_ci * the <b>OH_NativeImage</b> will not actively perform memory rendering processing.\n
2927777dab0Sopenharmony_ci * This method can not be used at the same time with <b>OH_NativeImage_UpdateSurfaceImage</b>.\n
2937777dab0Sopenharmony_ci * This interface is used in conjunction with <b>OH_NativeImage_AcquireNativeWindowBuffer<\b> and
2947777dab0Sopenharmony_ci * <b>OH_NativeImage_ReleaseNativeWindowBuffer<\b>.\n
2957777dab0Sopenharmony_ci * This interface needs to be used in conjunction with <b>OH_NativeImage_Destroy<\b>,
2967777dab0Sopenharmony_ci * otherwise memory leaks will occur.\n
2977777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
2987777dab0Sopenharmony_ci *
2997777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
3007777dab0Sopenharmony_ci * @return Returns the pointer to the <b>OH_NativeImage</b> instance created if the operation is successful, \n
3017777dab0Sopenharmony_ci * returns <b>NULL</b> otherwise.
3027777dab0Sopenharmony_ci * @since 12
3037777dab0Sopenharmony_ci * @version 1.0
3047777dab0Sopenharmony_ci */
3057777dab0Sopenharmony_ciOH_NativeImage* OH_ConsumerSurface_Create(void);
3067777dab0Sopenharmony_ci
3077777dab0Sopenharmony_ci/**
3087777dab0Sopenharmony_ci * @brief Set the default usage of the <b>OH_NativeImage</b>.\n
3097777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
3107777dab0Sopenharmony_ci *
3117777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
3127777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
3137777dab0Sopenharmony_ci * @param usage Indicates the usage of the <b>OH_NativeImage</b>.Refer to the enum <b>OH_NativeBuffer_Usage</b>.
3147777dab0Sopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success.
3157777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image is NULL.
3167777dab0Sopenharmony_ci * @since 13
3177777dab0Sopenharmony_ci * @version 1.0
3187777dab0Sopenharmony_ci */
3197777dab0Sopenharmony_ciint32_t OH_ConsumerSurface_SetDefaultUsage(OH_NativeImage* image, uint64_t usage);
3207777dab0Sopenharmony_ci
3217777dab0Sopenharmony_ci/**
3227777dab0Sopenharmony_ci * @brief Set the default size of the <b>OH_NativeImage</b>.\n
3237777dab0Sopenharmony_ci * This interface is a non-thread-safe type interface.\n
3247777dab0Sopenharmony_ci *
3257777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
3267777dab0Sopenharmony_ci * @param image Indicates the pointer to a <b>OH_NativeImage</b> instance.
3277777dab0Sopenharmony_ci * @param width Indicates the width of the <b>OH_NativeImage</b>, and it should be greater than 0.
3287777dab0Sopenharmony_ci * @param height Indicates the height of the <b>OH_NativeImage</b>, and it should be greater than 0.
3297777dab0Sopenharmony_ci * @return {@link NATIVE_ERROR_OK} 0 - Success.
3307777dab0Sopenharmony_ci *     {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image is NULL or width, height less than or equal to 0.
3317777dab0Sopenharmony_ci * @since 13
3327777dab0Sopenharmony_ci * @version 1.0
3337777dab0Sopenharmony_ci */
3347777dab0Sopenharmony_ciint32_t OH_ConsumerSurface_SetDefaultSize(OH_NativeImage* image, int32_t width, int32_t height);
3357777dab0Sopenharmony_ci#ifdef __cplusplus
3367777dab0Sopenharmony_ci}
3377777dab0Sopenharmony_ci#endif
3387777dab0Sopenharmony_ci
3397777dab0Sopenharmony_ci/** @} */
3407777dab0Sopenharmony_ci#endif