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