1 /* 2 * Copyright (c) 2024-2025 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 SKIA_PATH_ITERATOR_H 17 #define SKIA_PATH_ITERATOR_H 18 19 #include "include/core/SkPath.h" 20 21 #include "impl_interface/path_iterator_impl.h" 22 #include "utils/scalar.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 namespace Drawing { 27 class DRAWING_API SkiaPathIterator : public PathIteratorImpl { 28 public: 29 static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER; 30 31 explicit SkiaPathIterator(const Path &path) noexcept; ~SkiaPathIterator()32 ~SkiaPathIterator() override {}; 33 GetType()34 AdapterType GetType() const override 35 { 36 return AdapterType::SKIA_ADAPTER; 37 } 38 39 const SkPath::RawIter& ExportSkiaPathIterator() const; 40 scalar ConicWeight() const override; 41 PathVerb Next(Point* points) override; 42 PathVerb Peek() override; 43 private: 44 SkPath::RawIter skPathIterator_; 45 }; 46 47 class DRAWING_API SkiaPathIter : public PathIterImpl { 48 public: 49 static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER; ~SkiaPathIter()50 ~SkiaPathIter() override {}; 51 explicit SkiaPathIter(const Path& path, bool forceClose) noexcept; 52 GetType()53 AdapterType GetType() const override 54 { 55 return AdapterType::SKIA_ADAPTER; 56 } 57 58 const SkPath::Iter& ExportSkiaPathIter() const; 59 scalar ConicWeight() const override; 60 PathVerb Next(Point* points) override; 61 62 private: 63 SkPath::Iter skPathIter_; 64 }; 65 } // namespace Drawing 66 } // namespace Rosen 67 } // namespace OHOS 68 #endif 69