1 /*
2  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
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 #ifndef SVGPathSeg_h
22 #define SVGPathSeg_h
23 
24 #if ENABLE(SVG)
25 #include <wtf/text/WTFString.h>
26 
27 namespace WebCore {
28 
29 enum SVGPathSegType {
30     PathSegUnknown = 0,
31     PathSegClosePath = 1,
32     PathSegMoveToAbs = 2,
33     PathSegMoveToRel = 3,
34     PathSegLineToAbs = 4,
35     PathSegLineToRel = 5,
36     PathSegCurveToCubicAbs = 6,
37     PathSegCurveToCubicRel = 7,
38     PathSegCurveToQuadraticAbs = 8,
39     PathSegCurveToQuadraticRel = 9,
40     PathSegArcAbs = 10,
41     PathSegArcRel = 11,
42     PathSegLineToHorizontalAbs = 12,
43     PathSegLineToHorizontalRel = 13,
44     PathSegLineToVerticalAbs = 14,
45     PathSegLineToVerticalRel = 15,
46     PathSegCurveToCubicSmoothAbs = 16,
47     PathSegCurveToCubicSmoothRel = 17,
48     PathSegCurveToQuadraticSmoothAbs = 18,
49     PathSegCurveToQuadraticSmoothRel = 19
50 };
51 
52 enum SVGPathSegRole {
53     PathSegUnalteredRole = 0,
54     PathSegNormalizedRole = 1,
55     PathSegUndefinedRole = 2
56 };
57 
58 class SVGPathSeg : public RefCounted<SVGPathSeg> {
59 public:
SVGPathSeg()60     SVGPathSeg() { }
~SVGPathSeg()61     virtual ~SVGPathSeg() { }
62 
63     // Forward declare these enums in the w3c naming scheme, for IDL generation
64     enum {
65         PATHSEG_UNKNOWN = PathSegUnknown,
66         PATHSEG_CLOSEPATH = PathSegClosePath,
67         PATHSEG_MOVETO_ABS = PathSegMoveToAbs,
68         PATHSEG_MOVETO_REL = PathSegMoveToRel,
69         PATHSEG_LINETO_ABS = PathSegLineToAbs,
70         PATHSEG_LINETO_REL = PathSegLineToRel,
71         PATHSEG_CURVETO_CUBIC_ABS = PathSegCurveToCubicAbs,
72         PATHSEG_CURVETO_CUBIC_REL = PathSegCurveToCubicRel,
73         PATHSEG_CURVETO_QUADRATIC_ABS = PathSegCurveToQuadraticAbs,
74         PATHSEG_CURVETO_QUADRATIC_REL = PathSegCurveToQuadraticRel,
75         PATHSEG_ARC_ABS = PathSegArcAbs,
76         PATHSEG_ARC_REL = PathSegArcRel,
77         PATHSEG_LINETO_HORIZONTAL_ABS = PathSegLineToHorizontalAbs,
78         PATHSEG_LINETO_HORIZONTAL_REL = PathSegLineToHorizontalRel,
79         PATHSEG_LINETO_VERTICAL_ABS = PathSegLineToVerticalAbs,
80         PATHSEG_LINETO_VERTICAL_REL = PathSegLineToVerticalRel,
81         PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = PathSegCurveToCubicSmoothAbs,
82         PATHSEG_CURVETO_CUBIC_SMOOTH_REL = PathSegCurveToCubicSmoothRel,
83         PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = PathSegCurveToQuadraticSmoothAbs,
84         PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = PathSegCurveToQuadraticSmoothRel
85     };
86 
87     virtual unsigned short pathSegType() const = 0;
88     virtual String pathSegTypeAsLetter() const = 0;
89 };
90 
91 } // namespace WebCore
92 
93 #endif // ENABLE(SVG)
94 #endif
95