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_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 class SkPath; 28 namespace OHOS { 29 namespace Rosen { 30 class RSPath { 31 public: 32 RSPath(); 33 virtual ~RSPath(); 34 static std::shared_ptr<RSPath> CreateRSPath(); 35 static std::shared_ptr<RSPath> CreateRSPath(const SkPath& skPath); 36 static std::shared_ptr<RSPath> CreateRSPath(const std::string& path); 37 float GetDistance() const; 38 bool GetPosTan(float distance, Vector2f& pos, float& degrees) const; 39 40 std::shared_ptr<RSPath> Reverse(); 41 42 void SetSkiaPath(const SkPath& skPath); 43 const SkPath& GetSkiaPath() const; 44 45 private: 46 RSPath(const RSPath&) = delete; 47 RSPath(const RSPath&&) = delete; 48 RSPath& operator=(const RSPath&) = delete; 49 RSPath& operator=(const RSPath&&) = delete; 50 51 SkPath* skPath_ = nullptr; 52 }; 53 } // namespace Rosen 54 } // namespace OHOS 55 56 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_PATH_H 57