• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "cj_image_utils.h"
19 #include "ffi_remote_data.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     int64_t GetTimestamp();
35     uint32_t GetComponent(int32_t componentType, CRetComponent* ret);
36     void Release();
37 
38 private:
39     static int64_t Create(ImageImpl* image, std::shared_ptr<NativeImage> nativeImage);
40     std::shared_ptr<NativeImage> native_;
41     bool isTestImage_;
42     static ImageHolderManager<NativeImage> sNativeImageHolder_;
43 };
44 } // namespace Media
45 } // namespace OHOS
46 
47 #endif