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 
16 #ifndef OHOS_CJ_COLOR_MANAGER_H
17 #define OHOS_CJ_COLOR_MANAGER_H
18 
19 #include "cj_color_mgr_utils.h"
20 #include "color_space.h"
21 #include "ffi_remote_data.h"
22 
23 namespace OHOS {
24 namespace ColorManager {
25 class CjColorManager : public OHOS::FFI::FFIData {
26 public:
27     explicit CjColorManager(std::shared_ptr<ColorSpace> ptr);
~CjColorManager()28     ~CjColorManager() override
29     {
30         colorSpaceToken_ = nullptr;
31     }
32     static std::tuple<int32_t, std::string, std::shared_ptr<ColorSpace>> create(ApiColorSpaceType csType);
33     static std::shared_ptr<ColorSpace> create(ColorSpacePrimaries primaries, float gamma, int32_t* errCode);
GetColorSpaceToken()34     inline const std::shared_ptr<ColorSpace>& GetColorSpaceToken() const
35     {
36         return colorSpaceToken_;
37     }
38 
39     uint32_t GetColorSpaceName(int32_t* errCode);
40     std::array<float, DIMES_2> GetWhitePoint(int32_t* errCode);
41     float GetGamma(int32_t* errCode);
GetRuntimeType()42     OHOS::FFI::RuntimeType *GetRuntimeType() override { return GetClassType(); }
43 private:
44     friend class OHOS::FFI::RuntimeType;
45     friend class OHOS::FFI::TypeBase;
GetClassType()46     static OHOS::FFI::RuntimeType *GetClassType()
47     {
48         static OHOS::FFI::RuntimeType runtimeType =
49             OHOS::FFI::RuntimeType::Create<OHOS::FFI::FFIData>("CjColorManager");
50         return &runtimeType;
51     }
52     std::shared_ptr<ColorSpace> colorSpaceToken_;
53 };
54 } // namespace ColorManager
55 } // namespace OHOS
56 
57 #endif // OHOS_CJ_COLOR_MANAGER_H