• 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 
16 #ifndef SCENE_SRC_POSTPROCESS_UTIL_H
17 #define SCENE_SRC_POSTPROCESS_UTIL_H
18 
19 #include "converting_value.h"
20 
21 SCENE_BEGIN_NAMESPACE()
22 
23 template<uint32_t Bit>
24 struct PPEffectEnabledConverter {
PPEffectEnabledConverterPPEffectEnabledConverter25     PPEffectEnabledConverter(META_NS::ConstProperty<uint32_t> flags) : flags_(flags) {}
26 
27     using SourceType = bool;
28     using TargetType = uint32_t;
29 
ConvertToSourcePPEffectEnabledConverter30     SourceType ConvertToSource(META_NS::IAny& any, const TargetType& v) const
31     {
32         return v & Bit;
33     }
ConvertToTargetPPEffectEnabledConverter34     TargetType ConvertToTarget(const SourceType& v) const
35     {
36         return v ? flags_->GetValue() | Bit : flags_->GetValue() & ~Bit;
37     }
38 
39 private:
40     META_NS::ConstProperty<uint32_t> flags_;
41 };
42 
43 class IPPEffectInit : public CORE_NS::IInterface {
44     META_INTERFACE(CORE_NS::IInterface, IPPEffectInit, "ee72a777-45ff-42ff-b816-5f169b4453b0")
45 public:
46     virtual bool Init(const META_NS::IProperty::Ptr& flags) = 0;
47 };
48 
49 SCENE_END_NAMESPACE()
50 
51 #endif