2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
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.
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.
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.
21 #ifndef SVGTransform_h
22 #define SVGTransform_h
25 #include "FloatPoint.h"
26 #include "SVGMatrix.h"
34 enum SVGTransformType {
35 SVG_TRANSFORM_UNKNOWN = 0,
36 SVG_TRANSFORM_MATRIX = 1,
37 SVG_TRANSFORM_TRANSLATE = 2,
38 SVG_TRANSFORM_SCALE = 3,
39 SVG_TRANSFORM_ROTATE = 4,
40 SVG_TRANSFORM_SKEWX = 5,
41 SVG_TRANSFORM_SKEWY = 6
45 SVGTransform(SVGTransformType);
46 explicit SVGTransform(const AffineTransform&);
48 SVGTransformType type() const { return m_type; }
50 SVGMatrix& svgMatrix() { return static_cast<SVGMatrix&>(m_matrix); }
51 AffineTransform matrix() const { return m_matrix; }
54 float angle() const { return m_angle; }
55 FloatPoint rotationCenter() const { return m_center; }
57 void setMatrix(const AffineTransform&);
58 void setTranslate(float tx, float ty);
59 void setScale(float sx, float sy);
60 void setRotate(float angle, float cx, float cy);
61 void setSkewX(float angle);
62 void setSkewY(float angle);
64 // Internal use only (animation system)
65 FloatPoint translate() const;
66 FloatSize scale() const;
68 bool isValid() const { return m_type != SVG_TRANSFORM_UNKNOWN; }
69 String valueAsString() const;
72 friend bool operator==(const SVGTransform& a, const SVGTransform& b);
74 SVGTransformType m_type;
77 AffineTransform m_matrix;
80 inline bool operator==(const SVGTransform& a, const SVGTransform& b)
82 return a.m_type == b.m_type && a.m_angle == b.m_angle && a.m_matrix == b.m_matrix;
85 inline bool operator!=(const SVGTransform& a, const SVGTransform& b)
90 } // namespace WebCore