1 /*
2  * Copyright (c) 2024 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 #ifndef IMAGE_IMPL_H
16 #define IMAGE_IMPL_H
17 
18 #include "ffi_remote_data.h"
19 #include "image_utils.h"
20 #include "image_holder_manager.h"
21 #include "native_image.h"
22 
23 namespace OHOS {
24 namespace Media {
25 
26 class ImageImpl : public OHOS::FFI::FFIData {
27     DECL_TYPE(ImageImpl, OHOS::FFI::FFIData)
28 public:
29     explicit ImageImpl(std::shared_ptr<NativeImage> nativeImage);
30     std::shared_ptr<NativeImage> GetNativeImage();
31     uint32_t GetClipRect(CRegion *ret);
32     uint32_t GetSize(CSize *ret);
33     uint32_t GetFormat(int32_t *ret);
34     uint32_t GetComponent(int32_t componentType, CRetComponent *ret);
35     void Release();
36 
37 private:
38     static int64_t Create(ImageImpl *image, std::shared_ptr<NativeImage> nativeImage);
39     std::shared_ptr<NativeImage> native_;
40     bool isTestImage_;
41     static ImageHolderManager<NativeImage> sNativeImageHolder_;
42 };
43 }
44 }
45 
46 #endif