• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 FOUNDATION_ACE_FRAMEWORKS_COMPONENTS_NG_RENDER_ADAPTER_ROSEN_MODIFIER_PROPERTY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_COMPONENTS_NG_RENDER_ADAPTER_ROSEN_MODIFIER_PROPERTY_H
18 
19 #include "render_service_client/core/modifier/rs_property_modifier.h"
20 #include "render_service_client/core/ui/rs_node.h"
21 
22 namespace OHOS::Ace::NG {
23 template<typename T>
24 bool CreateOrSetModifierValue(std::shared_ptr<Rosen::RSAnimatableProperty<T>>& property, const T& value);
25 
26 void AddOrChangeScaleModifier(std::shared_ptr<Rosen::RSNode>& rsNode,
27     std::shared_ptr<Rosen::RSScaleModifier>& modifier,
28     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Vector2f>>& property, const Rosen::Vector2f& value);
29 
30 void AddOrChangeTranslateZModifier(std::shared_ptr<Rosen::RSNode>& rsNode,
31     std::shared_ptr<Rosen::RSTranslateZModifier>& modifier,
32     std::shared_ptr<Rosen::RSAnimatableProperty<float>>& property, const float value);
33 
34 void AddOrChangeTranslateModifier(std::shared_ptr<Rosen::RSNode>& rsNode,
35     std::shared_ptr<Rosen::RSTranslateModifier>& modifier,
36     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Vector2f>>& property, const Rosen::Vector2f& value);
37 
38 void AddOrChangeQuaternionModifier(std::shared_ptr<Rosen::RSNode>& rsNode,
39     std::shared_ptr<Rosen::RSQuaternionModifier>& modifier,
40     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Quaternion>>& property, const Rosen::Quaternion& value);
41 
42 struct TransformMatrixModifier {
43     std::shared_ptr<Rosen::RSTranslateModifier> translateXY;
44     std::shared_ptr<Rosen::RSTranslateZModifier> translateZ;
45     std::shared_ptr<Rosen::RSScaleModifier> scaleXY;
46     std::shared_ptr<Rosen::RSQuaternionModifier> quaternion;
47     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Vector2f>> translateXYValue;
48     std::shared_ptr<Rosen::RSAnimatableProperty<float>> translateZValue;
49     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Vector2f>> scaleXYValue;
50     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Quaternion>> quaternionValue;
51 };
52 
53 struct SharedTransitionModifier {
54     std::shared_ptr<Rosen::RSTranslateModifier> translateXY;
55     std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::Vector2f>> translateXYValue;
56 };
57 } // namespace OHOS::Ace::NG
58 
59 #endif // FOUNDATION_ACE_FRAMEWORKS_COMPONENTS_NG_RENDER_ADAPTER_ROSEN_MODIFIER_PROPERTY_H