• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PROPERTY_ANIMATION_H
17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PROPERTY_ANIMATION_H
18 
19 #include "animation/rs_render_animation.h"
20 #include "common/rs_common_def.h"
21 #include "common/rs_macros.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class RSRenderPropertyBase;
26 class RSAnimationLog;
27 
28 class RSB_EXPORT RSRenderPropertyAnimation : public RSRenderAnimation {
29 public:
30     virtual ~RSRenderPropertyAnimation() = default;
31 
32     PropertyId GetPropertyId() const override;
33 
34     void SetAdditive(bool isAdditive);
35 
36     bool GetAdditive();
37 
38     void AttachRenderProperty(const std::shared_ptr<RSRenderPropertyBase>& property) override;
39     bool Marshalling(Parcel& parcel) const override;
40 protected:
41     RSRenderPropertyAnimation(AnimationId id, const PropertyId& propertyId,
42         const std::shared_ptr<RSRenderPropertyBase>& originValue);
43     RSRenderPropertyAnimation() =default;
44     bool ParseParam(Parcel& parcel) override;
45     void SetPropertyValue(const std::shared_ptr<RSRenderPropertyBase>& value);
46 
47     const std::shared_ptr<RSRenderPropertyBase> GetPropertyValue() const;
48 
49     const std::shared_ptr<RSRenderPropertyBase>& GetOriginValue() const;
50 
51     const std::shared_ptr<RSRenderPropertyBase>& GetLastValue() const;
52 
53     void SetAnimationValue(const std::shared_ptr<RSRenderPropertyBase>& value);
54 
55     const std::shared_ptr<RSRenderPropertyBase> GetAnimationValue(const std::shared_ptr<RSRenderPropertyBase>& value);
56 
57     void OnRemoveOnCompletion() override;
58 
InitValueEstimator()59     virtual void InitValueEstimator() {}
60 
61 protected:
62     PropertyId propertyId_;
63     std::shared_ptr<RSRenderPropertyBase> originValue_;
64     std::shared_ptr<RSRenderPropertyBase> lastValue_;
65     std::shared_ptr<RSRenderPropertyBase> property_;
66     std::shared_ptr<RSValueEstimator> valueEstimator_;
67 
68 private:
69     bool isAdditive_ { true };
70 };
71 } // namespace Rosen
72 } // namespace OHOS
73 
74 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PROPERTY_ANIMATION_H
75