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_RENDER_RS_PATH_H 17 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_PATH_H 18 19 #include <memory> 20 #include <string> 21 22 #include "common/rs_macros.h" 23 #include "common/rs_matrix3.h" 24 #include "common/rs_rect.h" 25 #include "common/rs_vector2.h" 26 27 #include "draw/path.h" 28 namespace OHOS { 29 namespace Rosen { 30 class RSB_EXPORT RSPath { 31 public: 32 RSPath(); 33 virtual ~RSPath(); 34 static RSB_EXPORT std::shared_ptr<RSPath> CreateRSPath(); 35 static RSB_EXPORT std::shared_ptr<RSPath> CreateRSPath(const Drawing::Path& path); 36 static RSB_EXPORT std::shared_ptr<RSPath> CreateRSPath(const std::string& path); 37 float GetDistance() const; 38 template<typename T> GetPosTan(float distance,T & pos,float & degrees)39 bool GetPosTan(float distance, T& pos, float& degrees) const 40 { 41 return true; 42 } 43 44 std::shared_ptr<RSPath> Reverse(); 45 46 void SetDrawingPath(const Drawing::Path& path); 47 const Drawing::Path& GetDrawingPath() const; 48 49 private: 50 RSPath(const RSPath&) = delete; 51 RSPath(const RSPath&&) = delete; 52 RSPath& operator=(const RSPath&) = delete; 53 RSPath& operator=(const RSPath&&) = delete; 54 55 Drawing::Path* drPath_ = nullptr; 56 }; 57 58 template<> 59 RSB_EXPORT bool RSPath::GetPosTan(float distance, Vector2f& pos, float& degrees) const; 60 template<> 61 RSB_EXPORT bool RSPath::GetPosTan(float distance, Vector4f& pos, float& degrees) const; 62 } // namespace Rosen 63 } // namespace OHOS 64 65 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_PATH_H 66