| 1 | /* |
| 2 | * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. |
| 3 | * Copyright (C) 2015-2019 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Library General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Library General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Library General Public License |
| 16 | * along with this library; see the file COPYING.LIB. If not, write to |
| 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | * Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include "SVGPathConsumer.h" |
| 24 | #include <wtf/text/WTFString.h> |
| 25 | |
| 26 | namespace WebCore { |
| 27 | |
| 28 | class FloatPoint; |
| 29 | class Path; |
| 30 | class SVGPathByteStream; |
| 31 | class SVGPathSeg; |
| 32 | class SVGPathSegList; |
| 33 | |
| 34 | // Path -> String |
| 35 | String buildStringFromPath(const Path&); |
| 36 | |
| 37 | // String/SVGPathByteStream -> Path |
| 38 | Path buildPathFromString(const String&); |
| 39 | Path buildPathFromByteStream(const SVGPathByteStream&); |
| 40 | |
| 41 | // SVGPathSegList/String -> SVGPathByteStream |
| 42 | bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&, SVGPathByteStream& result, PathParsingMode, bool checkForInitialMoveTo = true); |
| 43 | bool buildSVGPathByteStreamFromString(const String&, SVGPathByteStream&, PathParsingMode); |
| 44 | |
| 45 | // SVGPathByteStream -> String |
| 46 | bool buildStringFromByteStream(const SVGPathByteStream&, String&, PathParsingMode, bool checkForInitialMoveTo = true); |
| 47 | |
| 48 | // SVGPathByteStream -> SVGPathSegList |
| 49 | bool buildSVGPathSegListFromByteStream(const SVGPathByteStream&, SVGPathSegList&, PathParsingMode); |
| 50 | |
| 51 | bool canBlendSVGPathByteStreams(const SVGPathByteStream& from, const SVGPathByteStream& to); |
| 52 | |
| 53 | bool buildAnimatedSVGPathByteStream(const SVGPathByteStream& from, const SVGPathByteStream& to, SVGPathByteStream& result, float progress); |
| 54 | bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& from, unsigned repeatCount = 1); |
| 55 | |
| 56 | bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream&, float length, unsigned& pathSeg); |
| 57 | bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream&, float& totalLength); |
| 58 | bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&, float length, FloatPoint&); |
| 59 | |
| 60 | } // namespace WebCore |
| 61 | |