• 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 FRAMEWORKS_KITS_TAIHE_INCLUDE_IMAGE_TAIHE_H
17 #define FRAMEWORKS_KITS_TAIHE_INCLUDE_IMAGE_TAIHE_H
18 
19 #include "image_holder_manager.h"
20 #include "native_image.h"
21 #include "ohos.multimedia.image.image.proj.hpp"
22 #include "ohos.multimedia.image.image.impl.hpp"
23 #include "taihe/runtime.hpp"
24 
25 namespace ANI::Image {
26 using namespace taihe;
27 using namespace ohos::multimedia::image::image;
28 
29 class ImageImpl {
30 public:
31     ImageImpl();
32     explicit ImageImpl(std::shared_ptr<OHOS::Media::NativeImage> nativeImage);
33     ~ImageImpl();
34 
35     static struct Image Create(std::shared_ptr<OHOS::Media::NativeImage> nativeImage);
36     void ReleaseSync();
37 
38     Size GetSize();
39     int32_t GetFormat();
40 
41 private:
42     static OHOS::Media::ImageHolderManager<OHOS::Media::NativeImage> sNativeImageHolder_;
43     std::shared_ptr<OHOS::Media::NativeImage> nativeImage_;
44     bool isTestImage_ = false;
45     bool isRelease = false;
46 };
47 } // namespace ANI::Image
48 
49 #endif // FRAMEWORKS_KITS_TAIHE_INCLUDE_IMAGE_TAIHE_H