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_MOTION_PATH_OPTION_H 17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_MOTION_PATH_OPTION_H 18 19 #include <string> 20 21 #include "animation/rs_animation_common.h" 22 #include "common/rs_macros.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 27 class RSC_EXPORT RSMotionPathOption { 28 public: RSMotionPathOption(const std::string & path)29 RSMotionPathOption(const std::string& path) : path_(path) {} 30 31 virtual ~RSMotionPathOption() = default; 32 GetPath()33 std::string GetPath() const 34 { 35 return path_; 36 } 37 SetBeginFraction(float beginFraction)38 void SetBeginFraction(float beginFraction) 39 { 40 beginFraction_ = beginFraction; 41 } 42 GetBeginFraction()43 float GetBeginFraction() const 44 { 45 return beginFraction_; 46 } 47 SetEndFraction(float endFraction)48 void SetEndFraction(float endFraction) 49 { 50 endFraction_ = endFraction; 51 } 52 GetEndFraction()53 float GetEndFraction() const 54 { 55 return endFraction_; 56 } 57 SetRotationMode(const RotationMode & rotationMode)58 void SetRotationMode(const RotationMode& rotationMode) 59 { 60 rotationMode_ = rotationMode; 61 } 62 GetRotationMode()63 RotationMode GetRotationMode() const 64 { 65 return rotationMode_; 66 } 67 SetPathNeedAddOrigin(bool pathNeedOrigin)68 void SetPathNeedAddOrigin(bool pathNeedOrigin) 69 { 70 pathNeedOrigin_ = pathNeedOrigin; 71 } 72 GetPathNeedAddOrigin()73 bool GetPathNeedAddOrigin() 74 { 75 return pathNeedOrigin_; 76 } 77 78 private: 79 std::string path_; 80 float beginFraction_ { FRACTION_MIN }; 81 float endFraction_ { FRACTION_MAX }; 82 bool pathNeedOrigin_ { true }; 83 RotationMode rotationMode_ { RotationMode::ROTATE_NONE }; 84 }; 85 } // namespace Rosen 86 } // namespace OHOS 87 88 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_MOTION_PATH_OPTION_H 89