• 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);
RSRenderPropertyAnimation(AnimationId id,const PropertyId & propertyId)43     RSRenderPropertyAnimation(AnimationId id, const PropertyId& propertyId) : RSRenderAnimation(id)
44     {
45         propertyId_ = propertyId;
46     }
47     RSRenderPropertyAnimation() =default;
48     bool ParseParam(Parcel& parcel) override;
49     void SetPropertyValue(const std::shared_ptr<RSRenderPropertyBase>& value);
50 
51     const std::shared_ptr<RSRenderPropertyBase> GetPropertyValue() const;
52 
53     const std::shared_ptr<RSRenderPropertyBase>& GetOriginValue() const;
54 
55     const std::shared_ptr<RSRenderPropertyBase>& GetLastValue() const;
56 
57     void SetAnimationValue(const std::shared_ptr<RSRenderPropertyBase>& value);
58 
59     const std::shared_ptr<RSRenderPropertyBase> GetAnimationValue(const std::shared_ptr<RSRenderPropertyBase>& value);
60 
61     void OnRemoveOnCompletion() override;
62 
InitValueEstimator()63     virtual void InitValueEstimator() {}
64 
65 protected:
66     PropertyId propertyId_;
67     std::shared_ptr<RSRenderPropertyBase> originValue_;
68     std::shared_ptr<RSRenderPropertyBase> lastValue_;
69     std::shared_ptr<RSRenderPropertyBase> property_;
70     std::shared_ptr<RSValueEstimator> valueEstimator_;
71 
72 private:
73     bool isAdditive_ { true };
74 };
75 } // namespace Rosen
76 } // namespace OHOS
77 
78 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PROPERTY_ANIMATION_H
79