• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FILTER_H
17 #define FILTER_H
18 
19 #include "common/rs_macros.h"
20 #include "effect/image_filter.h"
21 #include "effect/mask_filter.h"
22 #include "effect/path_effect.h"
23 #include "utils/drawing_macros.h"
24 #include "utils/scalar.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 namespace Drawing {
29 #ifndef USE_ROSEN_DRAWING
30 class RS_EXPORT Filter {
31 #else
32 class DRAWING_API Filter {
33 #endif
34 public:
35     enum class FilterQuality {
36         NONE,
37         LOW,
38         MEDIUM,
39         HIGH,
40     };
41 
42     Filter() noexcept;
~Filter()43     ~Filter() {};
44 
45     void SetColorFilter(std::shared_ptr<ColorFilter> colorFilter);
46     std::shared_ptr<ColorFilter> GetColorFilter() const;
47 
48     void SetImageFilter(std::shared_ptr<ImageFilter> imageFilter);
49     std::shared_ptr<ImageFilter> GetImageFilter() const;
50 
51     void SetMaskFilter(std::shared_ptr<MaskFilter> maskFilter);
52     std::shared_ptr<MaskFilter> GetMaskFilter() const;
53 
54     FilterQuality GetFilterQuality() const;
55     void SetFilterQuality(FilterQuality fq);
56 
57     void Reset();
58 
59     friend bool operator==(const Filter& f1, const Filter& f2);
60     friend bool operator!=(const Filter& f1, const Filter& f2);
61 
62 private:
63     std::shared_ptr<ColorFilter> colorFilter_;
64     std::shared_ptr<ImageFilter> imageFilter_;
65     std::shared_ptr<MaskFilter> maskFilter_;
66     FilterQuality filterQuality_;
67 };
68 } // namespace Drawing
69 } // namespace Rosen
70 } // namespace OHOS
71 #endif