diff --git a/multimedia/image_framework/BUILD.gn b/multimedia/image_framework/BUILD.gn index 22c7d1fb908ed19139950abfb1de3f76419652bf..2043db91245b223b2cec04e8e533a5be7a35a03d 100644 --- a/multimedia/image_framework/BUILD.gn +++ b/multimedia/image_framework/BUILD.gn @@ -72,3 +72,13 @@ 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("libimage_format_convert_ndk") { + ndk_description_file = "./libimage_format_convert_ndk.ndk.json" + output_name = "image_format_convert_ndk" +} + +ohos_ndk_headers("image_format_convert_ndk_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework" + sources = [ "./include/image_format_convert_mdk.h" ] +} \ No newline at end of file diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h new file mode 100644 index 0000000000000000000000000000000000000000..4562e01b76a63d3019972fa0f8246b34731c4ad7 --- /dev/null +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2023 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 native APIs to convert image format. + * + * @Syscap SystemCapability.Multimedia.Image + */ + +/** + * @file image_format_convert_mdk.h + * + * @brief Declares APIs to convert image fromat. + * + * @Syscap SystemCapability.Multimedia.Image + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H + +#include "napi/native_api.h" +#include "image_mdk_common.h" +#include "pixelmap2_impl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Convert image format from RGB to YUV by PixelMap. + * + * @param srcPixelMap Source Image PixelMap + * @param destPixelMap Destination Image PixelMap + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + */ +int32_t OH_ImageConvert_YuvToRgb(OH_PixelMap2 *srcPixelMap, OH_PixelMap2 **destPixelMap, int32_t destPixelFormat); + +/** + * @brief Convert image format from RGB to YUV by PixelMap. + * + * @param srcPixelMap Source Image PixelMap + * @param destPixelMap Destination Image PixelMap + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + */ +int32_t OH_ImageConvert_RgbToYuv(OH_PixelMap2 *srcPixelMap, OH_PixelMap2 **destPixelMap, int32_t destPixelFormat); + +#ifdef __cplusplus +}; +#endif +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H \ No newline at end of file diff --git a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..b3f77c92e65637e5b9f3bbf24ac371cf915e8ec6 --- /dev/null +++ b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json @@ -0,0 +1,10 @@ +[ + { + "first_introduced": "12", + "name": "OH_ImageConvert_YuvToRgb" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_RgbToYuv" + } +] \ No newline at end of file