• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ANI_SRC_INCLUDE_IMAGE_ANI_UTILS_H
17 #define ANI_SRC_INCLUDE_IMAGE_ANI_UTILS_H
18 
19 #include <ani.h>
20 #include "image_source_ani.h"
21 #include "pixel_map.h"
22 #include "pixel_map_ani.h"
23 #include "picture_ani.h"
24 
25 namespace OHOS {
26 namespace Media {
27 
28 class ImageAniUtils {
29 public:
30     static PixelMap* GetPixelMapFromEnv([[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object obj);
31     static std::shared_ptr<PixelMap> GetPixelMapFromEnvSp([[maybe_unused]] ani_env* env,
32         [[maybe_unused]] ani_object obj);
33     static ImageSourceAni* GetImageSourceAniFromEnv([[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object obj);
34     static std::shared_ptr<ImageSource> GetImageSourceFromEnv([[maybe_unused]] ani_env* env,
35         [[maybe_unused]] ani_object obj);
36     static std::shared_ptr<Picture> GetPictureFromEnv([[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object obj);
37     static ani_object CreateImageInfoValueFromNative(ani_env* env, const ImageInfo &imgInfo, PixelMap* pixelmap);
38     static ani_object CreateAniPixelMap(ani_env* env, std::unique_ptr<PixelMapAni>& pPixelMapAni);
39     static ani_object CreateAniImageSource(ani_env* env, std::unique_ptr<ImageSourceAni>& pImageSourceAni);
40     static ani_object CreateAniPicture(ani_env* env, std::unique_ptr<PictureAni>& pPictureAni);
41     static ani_string GetAniString(ani_env *env, const std::string& str);
42     static ani_method GetRecordSetMethod(ani_env* env, ani_object &argumentObj);
43 };
44 
45 } // namespace Media
46 } // namespace OHOS
47 
48 #endif // ANI_SRC_INCLUDE_IMAGE_ANI_UTILS_H