1 /*
2  * Copyright (c) 2021-2023 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 COLOR_SPACE_IMPL_H
17 #define COLOR_SPACE_IMPL_H
18 
19 #include "include/core/SkColorSpace.h"
20 
21 #include "base_impl.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 namespace Drawing {
26 class Data;
27 enum class CMSTransferFuncType;
28 enum class CMSMatrixType;
29 struct CMSTransferFunction;
30 struct CMSMatrix3x3;
31 class ColorSpace;
32 class Image;
33 class ColorSpaceImpl : public BaseImpl {
34 public:
ColorSpaceImpl()35     ColorSpaceImpl() noexcept {}
~ColorSpaceImpl()36     ~ColorSpaceImpl() override {}
37 
38     virtual void InitWithSRGB() = 0;
39     virtual void InitWithSRGBLinear() = 0;
40     virtual void InitWithImage(const Image& image) = 0;
41     virtual void InitWithRGB(const CMSTransferFuncType& func, const CMSMatrixType& matrix) = 0;
42     virtual void InitWithCustomRGB(const CMSTransferFunction& func, const CMSMatrix3x3& matrix) = 0;
43     virtual sk_sp<SkColorSpace> GetSkColorSpace() const = 0;
44     virtual std::shared_ptr<Data> Serialize() const = 0;
45     virtual bool Deserialize(std::shared_ptr<Data> data) = 0;
46     virtual bool IsSRGB() const = 0;
47     virtual bool Equals(const std::shared_ptr<ColorSpace>& colorSpace) const = 0;
48 };
49 } // namespace Drawing
50 } // namespace Rosen
51 } // namespace OHOS
52 #endif