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 RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_TRANSITION_PROPERTIES_H 17 #define RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_TRANSITION_PROPERTIES_H 18 19 #include <vector> 20 21 #include "common/rs_vector3.h" 22 #include "include/core/SkMatrix44.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSTransitionProperties final { 27 public: 28 RSTransitionProperties() = default; 29 ~RSTransitionProperties() = default; 30 DoAlphaTransition(float alpha)31 void DoAlphaTransition(float alpha) 32 { 33 alpha_ *= alpha; 34 } DoTranslateTransition(const Vector3f & translate)35 void DoTranslateTransition(const Vector3f& translate) 36 { 37 translate_ += translate; 38 } DoScaleTransition(const Vector3f & scale)39 void DoScaleTransition(const Vector3f& scale) 40 { 41 scale_ *= scale; 42 } DoRotateTransition(const SkMatrix44 & rotateMatrix)43 void DoRotateTransition(const SkMatrix44& rotateMatrix) 44 { 45 rotate_.preConcat(rotateMatrix); 46 } 47 GetAlpha()48 float GetAlpha() const 49 { 50 return alpha_; 51 } GetTranslate()52 Vector3f GetTranslate() const 53 { 54 return translate_; 55 } GetScale()56 Vector3f GetScale() const 57 { 58 return scale_; 59 } GetRotate()60 SkMatrix44 GetRotate() const 61 { 62 return rotate_; 63 } 64 65 private: 66 float alpha_ = 1.0f; 67 Vector3f translate_ = { 0.0f, 0.0f, 0.0f }; 68 Vector3f scale_ = { 1.0f, 1.0f, 1.0f }; 69 SkMatrix44 rotate_ = SkMatrix44::I(); 70 }; 71 } // namespace Rosen 72 } // namespace OHOS 73 74 #endif // RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_TRANSITION_PROPERTIES_H 75