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
26namespace WebCore {
27
28class FloatPoint;
29class Path;
30class SVGPathByteStream;
31class SVGPathSeg;
32class SVGPathSegList;
33
34// Path -> String
35String buildStringFromPath(const Path&);
36
37// String/SVGPathByteStream -> Path
38Path buildPathFromString(const String&);
39Path buildPathFromByteStream(const SVGPathByteStream&);
40
41// SVGPathSegList/String -> SVGPathByteStream
42bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&, SVGPathByteStream& result, PathParsingMode, bool checkForInitialMoveTo = true);
43bool buildSVGPathByteStreamFromString(const String&, SVGPathByteStream&, PathParsingMode);
44
45// SVGPathByteStream -> String
46bool buildStringFromByteStream(const SVGPathByteStream&, String&, PathParsingMode, bool checkForInitialMoveTo = true);
47
48// SVGPathByteStream -> SVGPathSegList
49bool buildSVGPathSegListFromByteStream(const SVGPathByteStream&, SVGPathSegList&, PathParsingMode);
50
51bool canBlendSVGPathByteStreams(const SVGPathByteStream& from, const SVGPathByteStream& to);
52
53bool buildAnimatedSVGPathByteStream(const SVGPathByteStream& from, const SVGPathByteStream& to, SVGPathByteStream& result, float progress);
54bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& from, unsigned repeatCount = 1);
55
56bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream&, float length, unsigned& pathSeg);
57bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream&, float& totalLength);
58bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&, float length, FloatPoint&);
59
60} // namespace WebCore
61