From 58c96f7de9aae8f3f4527a469f4fd66b2d9942fc Mon Sep 17 00:00:00 2001 From: caochuan Date: Mon, 4 Mar 2024 15:42:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Feature:=20ImageReceiver=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=BA=AFnative=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: caochuan --- multimedia/image_framework/BUILD.gn | 22 + .../image_framework/include/image/image2.h | 312 ++++++++++++++ .../include/image/imageReceiver2.h | 407 ++++++++++++++++++ .../include/image/image_common.h | 145 +++++++ multimedia/image_framework/libimage2.ndk.json | 54 +++ .../libimageReceiver2.ndk.json | 66 +++ 6 files changed, 1006 insertions(+) create mode 100644 multimedia/image_framework/include/image/image2.h create mode 100644 multimedia/image_framework/include/image/imageReceiver2.h create mode 100644 multimedia/image_framework/include/image/image_common.h create mode 100644 multimedia/image_framework/libimage2.ndk.json create mode 100644 multimedia/image_framework/libimageReceiver2.ndk.json diff --git a/multimedia/image_framework/BUILD.gn b/multimedia/image_framework/BUILD.gn index 22c7d1fb9..1f0b1b64a 100644 --- a/multimedia/image_framework/BUILD.gn +++ b/multimedia/image_framework/BUILD.gn @@ -72,3 +72,25 @@ ohos_ndk_headers("image_packer_ndk_header") { dest_dir = "$ndk_headers_out_dir/multimedia/image_framework" sources = [ "./include/image_packer_mdk.h" ] } + +ohos_ndk_library("libimage2") { + ndk_description_file = "./libimage2.ndk.json" + min_compact_version = "12" + output_name = "image2" +} + +ohos_ndk_headers("image2_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework/image" + sources = [ "./include/image/image2.h" ] +} + +ohos_ndk_library("libimageReceiver2") { + ndk_description_file = "./libimageReceiver2.ndk.json" + min_compact_version = "12" + output_name = "imageReceiver2" +} + +ohos_ndk_headers("imageReceiver2_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework/image" + sources = [ "./include/image/imageReceiver2.h" ] +} diff --git a/multimedia/image_framework/include/image/image2.h b/multimedia/image_framework/include/image/image2.h new file mode 100644 index 000000000..40e70ed8c --- /dev/null +++ b/multimedia/image_framework/include/image/image2.h @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief Provides APIs for access to the image interface. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + * @version 5.0 + */ + +/** + * @file image2.h + * + * @brief Declares functions that access the image rectangle, size, format, and component data. + * Need link libimage_native.z.so + * + * @since 12 + * @version 5.0 + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE2_H +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE2_H + +#include "image_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines an OH_Image2 object at the native layer. + * + * @since 12 + * @version 5.0 + */ +struct OH_Image2; + +/** + * @brief Defines the data type name of a native image. + * + * @since 12 + * @version 5.0 + */ +typedef struct OH_Image2 OH_Image2; + +/** + * @brief Defines the image component object at the native layer. + * + * @since 12 + * @version 5.0 + */ +struct OH_Image2_Component; + +/** + * @brief Defines the data type name of a native image component. + * + * @since 12 + * @version 5.0 + */ +typedef struct OH_Image2_Component OH_Image2_Component; + +/** + * @brief Creates an empty OH_Image2_Component object at the application layer. + * + * @param component Indicates the pointer to the OH_Image2_Component object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_CreateComponent(OH_Image2_Component** component); + +/** + * @brief Set byteBuffer of an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param buffer Indicates the value of the {@link OH_Image2_Component} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_SetByteBuffer(OH_Image2_Component* component, uint8_t* buffer); + +/** + * @brief Get byteBuffer from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param buffer Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetByteBuffer(const OH_Image2_Component* component, uint8_t** buffer); + +/** + * @brief Set size from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param size Indicates the value of the {@link OH_Image2_Component} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_SetSize(OH_Image2_Component* component, size_t size); + +/** + * @brief Get size from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param size Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetSize(const OH_Image2_Component* component, size_t* size); + +/** + * @brief Set type from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param type Indicates the value of the {@link OH_Image2_Component} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_SetComponentType(OH_Image2_Component* component, int32_t type); + +/** + * @brief Get type from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param type Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetComponentType(const OH_Image2_Component* component, int32_t* type); + +/** + * @brief Set row stride from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param rowStride Indicates the value of the {@link OH_Image2_Component} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_SetRowStride(OH_Image2_Component* component, int32_t rowStride); + +/** + * @brief Get row stride from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param rowStride Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetRowStride(const OH_Image2_Component* component, int32_t* rowStride); + +/** + * @brief Set pixel stride from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param pixelStride Indicates the value of the {@link OH_Image2_Component} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_SetPixelStride(OH_Image2_Component* component, int32_t pixelStride); + +/** + * @brief Get pixel stride from an {@link OH_Image2_Component} object at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @param pixelStride Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetPixelStride(const OH_Image2_Component* component, int32_t* pixelStride); + +/** + * @brief Releases an {@link OH_Image2_Component} object at the native layer. + * It is used to release the object {@link OH_Image2_Component} at the native layer. + * + * @param component Indicates the pointer to an {@link OH_Image2_Component} object at the native layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2_Component + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_ReleaseComponent(OH_Image2_Component* component); + +/** + * @brief Obtains {@link OH_Image_Region} of an {@link OH_Image2} at the native layer. + * + * @param image Indicates the pointer to an {@link OH_Image2} object at the native layer. + * @param rect Indicates the pointer to the {@link OH_Image_Region} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MEDIA_DEAD_OBJECT - if media object dead. + * @see OH_Image2, OH_Image_Region + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_ClipRect(const OH_Image2* image, struct OH_Image_Region* rect); + +/** + * @brief Obtains {@link OH_Image_Size} of an {@link OH_Image2} object at the native layer. + * + * @param image Indicates the pointer to an {@link OH_Image2} object at the native layer. + * @param size Indicates the pointer to the {@link OH_Image_Size} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MEDIA_DEAD_OBJECT - if media object dead. + * @see OH_Image2, OH_Image_Size + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_Size(const OH_Image2* image, struct OH_Image_Size* size); + +/** + * @brief Obtains the image format of an {@link OH_Image2} object at the native layer. + * + * @param image Indicates the pointer to an {@link OH_Image2} object at the native layer. + * @param format Indicates the pointer to the image format obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MEDIA_DEAD_OBJECT - if media object dead. + * @see OH_Image2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_Format(const OH_Image2* image, int32_t* format); + +/** + * @brief Obtains {@link OhosImageComponent} of an {@link OH_Image2} object at the native layer. + * + * @param image Indicates the pointer to an {@link OH_Image2} object at the native layer. + * @param componentType Indicates the type of the required component. + * @param component Indicates the pointer to the {@link OH_Image2_Component} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_GET_PARAMETER_FAILED - if Failed to obtain parameters. + * @see OH_Image2, OhosImageComponent + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_GetComponent(const OH_Image2* image, + int32_t componentType, OH_Image2_Component** component); + +/** + * @brief Releases an {@link OH_Image2} object at the native layer. + * It is used to release the object {@link OH_Image2} at the native layer. + * + * @param image Indicates the pointer to an {@link OH_Image2} object at the native layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_Image2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_Image2_Release(OH_Image2* image); + +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE2_H diff --git a/multimedia/image_framework/include/image/imageReceiver2.h b/multimedia/image_framework/include/image/imageReceiver2.h new file mode 100644 index 000000000..672838535 --- /dev/null +++ b/multimedia/image_framework/include/image/imageReceiver2.h @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief Provides APIs for obtaining image data from the native layer. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + * @version 5.0 + */ + +/** + * @file imageReceiver2.h + * + * @brief Declares the APIs for obtaining image data from the native layer. + * Need link libimage_native.z.so and libimage2.z.so + * @since 12 + * @version 5.0 + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER2_H +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER2_H + +#include "image2.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines an OH_ImageReceiver2 object at the native layer. + * + * @since 12 + * @version 5.0 + */ +struct OH_ImageReceiver2; + +/** + * @brief Defines the data type name of a native image receiver. + * + * @since 12 + * @version 5.0 + */ +typedef struct OH_ImageReceiver2 OH_ImageReceiver2; + +/** + * @brief Defines an image receiver info object at the native layer. + * + * @since 12 + * @version 5.0 + */ +struct OH_ImageReceiver2_Info; + +/** + * @brief Defines the data type name of a native image receiver info. + * + * @since 12 + * @version 5.0 + */ +typedef struct OH_ImageReceiver2_Info OH_ImageReceiver2_Info; + +/** + * @brief Defines the callbacks for images at the native layer. + * + * @since 12 + * @version 5.0 + */ +typedef void (*OH_Image_Receiver_On_Callback)(void); + +/** + * @brief Creates an OH_ImageReceiver2_Info object at the application layer. + * + * @param width Default width of the image received by the consumer, in pixels. + * @param height Default height of the image received by the consumer, in pixels. + * @param format Image format {@link OHOS_IMAGE_FORMAT_JPEG} created by using the receiver. + * @param capicity Maximum number of images that can be cached. + * @param info Indicates the pointer to the OH_ImageReceiver2_Info object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_CreateInfo( + int32_t width, int32_t height, int32_t format, int32_t capicity, + OH_ImageReceiver2_Info** info); + +/** + * @brief Set width of an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param width Indicates the value of the {@link OH_ImageReceiver2_Info} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_SetInfoWidth(OH_ImageReceiver2_Info* info, + int32_t width); + +/** + * @brief Get width from an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param width Indicates the pointer to the {@link OH_ImageReceiver2_Info} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetInfoWidth(const OH_ImageReceiver2_Info* info, + int32_t* width); + +/** + * @brief Set height of an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param height Indicates the value of the {@link OH_ImageReceiver2_Info} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_SetInfoHeight(OH_ImageReceiver2_Info* info, + int32_t height); + +/** + * @brief Get height from an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param height Indicates the pointer to the {@link OH_ImageReceiver2_Info} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetInfoHeight(const OH_ImageReceiver2_Info* info, + int32_t* height); + +/** + * @brief Set format of an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param format Indicates the value of the {@link OH_ImageReceiver2_Info} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_SetInfoFormat(OH_ImageReceiver2_Info* info, + int32_t format); + +/** + * @brief Get format from an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param format Indicates the pointer to the {@link OH_ImageReceiver2_Info} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetInfoFormat(const OH_ImageReceiver2_Info* info, + int32_t* format); + +/** + * @brief Set capicity of an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param capicity Indicates the value of the {@link OH_ImageReceiver2_Info} object seted. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_SetInfoCapicity(OH_ImageReceiver2_Info* info, + int32_t capicity); + +/** + * @brief Get capicity from an {@link OH_ImageReceiver2_Info} object at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @param capicity Indicates the pointer to the {@link OH_ImageReceiver2_Info} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetInfoCapicity(const OH_ImageReceiver2_Info* info, + int32_t* capicity); + +/** + * @brief Releases an {@link OH_ImageReceiver2_Info} object at the native layer. + * Note: This API is not used to release a JavaScript native API Image object. + * It is used to release the object {@link OH_ImageReceiver2_Info} at the native layer. + * + * @param info Indicates the pointer to an {@link OH_ImageReceiver2_Info} object at the native layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_ReleaseInfo(OH_ImageReceiver2_Info* info); + +/** + * @brief Creates an OH_ImageReceiver2 object at the application layer. + * + * @param info Indicates the options for setting the OH_ImageReceiver2 object. + * @param res Indicates the pointer to the OH_ImageReceiver2 object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if get data failed. + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_Create(struct OH_ImageReceiver2_Info* info, + OH_ImageReceiver2** res); + +/** + * @brief Obtains the receiver ID through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param id Indicates the pointer to the buffer that stores the ID string obtained. + * @param len Indicates the size of the buffer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if get data failed. + * @see OH_ImageReceiver2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetReceivingSurfaceId(const OH_ImageReceiver2* receiver, + char* id, size_t len); + +/** + * @brief Obtains the latest image through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param image Indicates the pointer to an OH_Image2 object at the application layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if get data failed. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * @see OH_ImageReceiver2, OH_Image2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_ReadLatestImage(const OH_ImageReceiver2* receiver, + OH_Image2** image); + +/** + * @brief Obtains the next image through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param image Indicates the pointer to an OH_Image2 object at the application layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if get data failed. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * @see OH_ImageReceiver2, OH_Image2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_ReadNextImage(const OH_ImageReceiver2* receiver, + OH_Image2** image); + +/** + * @brief Registers an {@link OH_Image_Receiver_On_Callback} callback event. + * + * This callback event is triggered whenever a new image is received. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param callback Indicates the {@link OH_Image_Receiver_On_Callback} callback event to register. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2, OH_Image_Receiver_On_Callback + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_On(const OH_ImageReceiver2* receiver, + OH_Image_Receiver_On_Callback callback); + +/** + * @brief Unregisters the {@link OH_Image_Receiver_On_Callback} callback event. + * + * This callback event is triggered whenever the image is shutdown. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2, OH_ImageReceiver2_On + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_Off(const OH_ImageReceiver2* receiver); + +/** + * @brief Obtains the info {@link OH_ImageReceiver2_Info} of the image receiver + * through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param infoNative Indicates the pointer to the {@link OH_ImageReceiver2_Info} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_MALLOC_ABNORMAL - if malloc failed. + * @see OH_ImageReceiver2, OH_ImageReceiver2_Info + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetInfo(const OH_ImageReceiver2* receiver, + OH_ImageReceiver2_Info** infoNative); + +/** + * @brief Obtains the size of the image receiver through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param size Indicates the pointer to the {@link OH_Image_Size} object obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2, OH_Image_Size + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetSize(const OH_ImageReceiver2* receiver, + struct OH_Image_Size* size); + +/** + * @brief Obtains the capacity of the image receiver through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param capacity Indicates the pointer to the capacity obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetCapacity(const OH_ImageReceiver2* receiver, + int32_t* capacity); + +/** + * @brief Obtains the format of the image receiver through an {@link OH_ImageReceiver2} object. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @param format Indicates the pointer to the format obtained. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_GetFormat(const OH_ImageReceiver2* receiver, + int32_t* format); + +/** + * @brief Releases an {@link OH_ImageReceiver2} object at the native layer. + * + * This API is not used to release an ImageReceiver2 object at the application layer. + * + * @param receiver Indicates the pointer to an {@link OH_ImageReceiver2} object at the native layer. + * @return Returns {@link OH_Image_ErrorCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * returns {@link OH_Image_ErrorCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. + * @see OH_ImageReceiver2 + * @since 12 + * @version 5.0 + */ +OH_Image_ErrorCode OH_ImageReceiver2_Release(OH_ImageReceiver2* receiver); + +#ifdef __cplusplus +}; +#endif +/** @} */ + +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER2_H diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h new file mode 100644 index 000000000..c9b1aac78 --- /dev/null +++ b/multimedia/image_framework/include/image/image_common.h @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief Provides APIs for access to the image interface. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + * @version 5.0 + */ + +/** + * @file image_common.h + * + * @brief Declares the common enums and structs used by the image interface. + * + * @since 12 + * @version 5.0 + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define IMAGE_RESULT_BASE 62980096 + +/** + * @brief Enumerates the return values that may be used by the interface. + * + * @since 12 + * @version 5.0 + */ +typedef enum { + IMAGE_RESULT_SUCCESS = 0, // Operation success + IMAGE_RESULT_BAD_PARAMETER = -1, // Invalid parameter + IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6, // image malloc error + IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19, // image invalid parameter + IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46, // media dead object + IMAGE_RESULT_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157, // Failed to obtain parameters + IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9, // image get data error + IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200, // media unknown error +} OH_Image_ErrorCode; + +/** + * @brief Defines the image size. + * + * @since 12 + * @version 5.0 + */ +struct OH_Image_Size { + /** Image width, in pixels. */ + int32_t width = 0; + /** Image height, in pixels. */ + int32_t height = 0; +}; + +/** + * @brief Defines the image region. + * + * @since 12 + * @version 5.0 + */ +struct OH_Image_Region { + /** X coordinate of the rectangle. */ + int32_t x = 0; + /** Y coordinate of the rectangle. */ + int32_t y = 0; + /** Width of the rectangle, in pixels. */ + int32_t width = 0; + /** Height of the rectangle, in pixels. */ + int32_t height = 0; +}; + +/** + * @brief Defines the image string. + * + * @since 12 + * @version 5.0 + */ +struct OH_Image_String { + /** */ + char* format = nullptr; + /** */ + size_t size = 0; +}; + +/** + * @brief Enumerates the image formats. + * + * @since 12 + * @version 5.0 + */ +enum { + /** YCbCr422 semi-planar format. */ + OHOS_IMAGE_FORMAT_YCBCR_422_SP = 1000, + /** JPEG encoding format. */ + OHOS_IMAGE_FORMAT_JPEG = 2000 +}; + +/** + * @brief Enumerates the image components. + * + * @since 12 + * @version 5.0 + */ +enum { + /** Luminance component. */ + OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y = 1, + /** Chrominance component - blue projection. */ + OHOS_IMAGE_COMPONENT_FORMAT_YUV_U = 2, + /** Chrominance component - red projection. */ + OHOS_IMAGE_COMPONENT_FORMAT_YUV_V = 3, + /** JPEG format. */ + OHOS_IMAGE_COMPONENT_FORMAT_JPEG = 4, +}; + +typedef OH_Image_String OH_Image_Property, OH_Image_MimeType; + +#ifdef __cplusplus +}; +#endif +/** @} */ + +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H \ No newline at end of file diff --git a/multimedia/image_framework/libimage2.ndk.json b/multimedia/image_framework/libimage2.ndk.json new file mode 100644 index 000000000..478f20439 --- /dev/null +++ b/multimedia/image_framework/libimage2.ndk.json @@ -0,0 +1,54 @@ +[ + { + "first_introduced": "12", + "name": "OH_Image2_CreateComponent" + }, + { + "name": "OH_Image2_SetByteBuffer" + }, + { + "name": "OH_Image2_GetByteBuffer" + }, + { + "name": "OH_Image2_SetSize" + }, + { + "name": "OH_Image2_GetSize" + }, + { + "name": "OH_Image2_SetComponentType" + }, + { + "name": "OH_Image2_GetComponentType" + }, + { + "name": "OH_Image2_SetRowStride" + }, + { + "name": "OH_Image2_GetRowStride" + }, + { + "name": "OH_Image2_SetPixelStride" + }, + { + "name": "OH_Image2_GetPixelStride" + }, + { + "name": "OH_Image2_ReleaseComponent" + }, + { + "name": "OH_Image2_ClipRect" + }, + { + "name": "OH_Image2_Size" + }, + { + "name": "OH_Image2_Format" + }, + { + "name": "OH_Image2_GetComponent" + }, + { + "name": "OH_Image2_Release" + } +] \ No newline at end of file diff --git a/multimedia/image_framework/libimageReceiver2.ndk.json b/multimedia/image_framework/libimageReceiver2.ndk.json new file mode 100644 index 000000000..5c432af38 --- /dev/null +++ b/multimedia/image_framework/libimageReceiver2.ndk.json @@ -0,0 +1,66 @@ +[ + { + "first_introduced": "12", + "name": "OH_ImageReceiver2_CreateInfo" + }, + { + "name": "OH_ImageReceiver2_SetInfoWidth" + }, + { + "name": "OH_ImageReceiver2_GetInfoWidth" + }, + { + "name": "OH_ImageReceiver2_SetInfoHeight" + }, + { + "name": "OH_ImageReceiver2_GetInfoHeight" + }, + { + "name": "OH_ImageReceiver2_SetInfoFormat" + }, + { + "name": "OH_ImageReceiver2_GetInfoFormat" + }, + { + "name": "OH_ImageReceiver2_SetInfoCapicity" + }, + { + "name": "OH_ImageReceiver2_GetInfoCapicity" + }, + { + "name": "OH_ImageReceiver2_ReleaseInfo" + }, + { + "name": "OH_ImageReceiver2_Create" + }, + { + "name": "OH_ImageReceiver2_GetReceivingSurfaceId" + }, + { + "name": "OH_ImageReceiver2_ReadLatestImage" + }, + { + "name": "OH_ImageReceiver2_ReadNextImage" + }, + { + "name": "OH_ImageReceiver2_On" + }, + { + "name": "OH_ImageReceiver2_Off" + }, + { + "name": "OH_ImageReceiver2_GetInfo" + }, + { + "name": "OH_ImageReceiver2_GetSize" + }, + { + "name": "OH_ImageReceiver2_GetCapacity" + }, + { + "name": "OH_ImageReceiver2_GetFormat" + }, + { + "name": "OH_ImageReceiver2_Release" + } +] -- Gitee From 06c637063e34892c17ee9e3d09368fe0eee3bbaa Mon Sep 17 00:00:00 2001 From: caochuan Date: Wed, 27 Mar 2024 06:53:32 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20mult?= =?UTF-8?q?imedia/image=5Fframework/include/image/image=5Fcommon.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/image/image_common.h | 145 ------------------ 1 file changed, 145 deletions(-) delete mode 100644 multimedia/image_framework/include/image/image_common.h diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h deleted file mode 100644 index c9b1aac78..000000000 --- a/multimedia/image_framework/include/image/image_common.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup image - * @{ - * - * @brief Provides APIs for access to the image interface. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 12 - * @version 5.0 - */ - -/** - * @file image_common.h - * - * @brief Declares the common enums and structs used by the image interface. - * - * @since 12 - * @version 5.0 - */ - -#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H -#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define IMAGE_RESULT_BASE 62980096 - -/** - * @brief Enumerates the return values that may be used by the interface. - * - * @since 12 - * @version 5.0 - */ -typedef enum { - IMAGE_RESULT_SUCCESS = 0, // Operation success - IMAGE_RESULT_BAD_PARAMETER = -1, // Invalid parameter - IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6, // image malloc error - IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19, // image invalid parameter - IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46, // media dead object - IMAGE_RESULT_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157, // Failed to obtain parameters - IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9, // image get data error - IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200, // media unknown error -} OH_Image_ErrorCode; - -/** - * @brief Defines the image size. - * - * @since 12 - * @version 5.0 - */ -struct OH_Image_Size { - /** Image width, in pixels. */ - int32_t width = 0; - /** Image height, in pixels. */ - int32_t height = 0; -}; - -/** - * @brief Defines the image region. - * - * @since 12 - * @version 5.0 - */ -struct OH_Image_Region { - /** X coordinate of the rectangle. */ - int32_t x = 0; - /** Y coordinate of the rectangle. */ - int32_t y = 0; - /** Width of the rectangle, in pixels. */ - int32_t width = 0; - /** Height of the rectangle, in pixels. */ - int32_t height = 0; -}; - -/** - * @brief Defines the image string. - * - * @since 12 - * @version 5.0 - */ -struct OH_Image_String { - /** */ - char* format = nullptr; - /** */ - size_t size = 0; -}; - -/** - * @brief Enumerates the image formats. - * - * @since 12 - * @version 5.0 - */ -enum { - /** YCbCr422 semi-planar format. */ - OHOS_IMAGE_FORMAT_YCBCR_422_SP = 1000, - /** JPEG encoding format. */ - OHOS_IMAGE_FORMAT_JPEG = 2000 -}; - -/** - * @brief Enumerates the image components. - * - * @since 12 - * @version 5.0 - */ -enum { - /** Luminance component. */ - OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y = 1, - /** Chrominance component - blue projection. */ - OHOS_IMAGE_COMPONENT_FORMAT_YUV_U = 2, - /** Chrominance component - red projection. */ - OHOS_IMAGE_COMPONENT_FORMAT_YUV_V = 3, - /** JPEG format. */ - OHOS_IMAGE_COMPONENT_FORMAT_JPEG = 4, -}; - -typedef OH_Image_String OH_Image_Property, OH_Image_MimeType; - -#ifdef __cplusplus -}; -#endif -/** @} */ - -#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_COMMON_H \ No newline at end of file -- Gitee