1967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch/*
2967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * Copyright (C) 2002, 2003 The Karbon Developers
3dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
4dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
5dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
6967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch *
8967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * This library is free software; you can redistribute it and/or
9967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * modify it under the terms of the GNU Library General Public
10967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * License as published by the Free Software Foundation; either
11967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * version 2 of the License, or (at your option) any later version.
12967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch *
13967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * This library is distributed in the hope that it will be useful,
14967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * but WITHOUT ANY WARRANTY; without even the implied warranty of
15967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * Library General Public License for more details.
17967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch *
18967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * You should have received a copy of the GNU Library General Public License
19967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * along with this library; see the file COPYING.LIB.  If not, write to
20967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch * Boston, MA 02110-1301, USA.
22967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch */
23967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
24967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#ifndef SVGPathBuilder_h
25967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#define SVGPathBuilder_h
26967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
27967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#if ENABLE(SVG)
28967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#include "FloatPoint.h"
29967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#include "Path.h"
30967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#include "SVGPathConsumer.h"
31967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
32967717af5423377c967781471ee106e2bb4e11c8Ben Murdochnamespace WebCore {
33967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
34dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass SVGPathBuilder : public SVGPathConsumer {
35967717af5423377c967781471ee106e2bb4e11c8Ben Murdochpublic:
36dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    SVGPathBuilder();
37dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
38dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    void setCurrentPath(Path* path) { m_path = path; }
395ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen
405ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsenprivate:
41f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    virtual void incrementPathSegmentCount() { }
42f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    virtual bool continueConsuming() { return true; }
43dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    virtual void cleanup() { m_path = 0; }
44967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
45967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    // Used in UnalteredParisng/NormalizedParsing modes.
46967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
47967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void lineTo(const FloatPoint&, PathCoordinateMode);
48967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
49967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void closePath();
50967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
51967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    // Only used in UnalteredParsing mode.
52967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void lineToHorizontal(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
53967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void lineToVertical(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
54967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
55967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
56967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
57dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
58967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
59dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    Path* m_path;
60967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    FloatPoint m_current;
61967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch};
62967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
63967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch} // namespace WebCore
64967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
65967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#endif // ENABLE(SVG)
66967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch#endif // SVGPathBuilder_h
67