KHtml

SVGTransform.h
1 /*
2  Copyright (C) 2004, 2005 Nikolas Zimmermann <[email protected]>
3  2004, 2005 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef SVGTransform_h
24 #define SVGTransform_h
25 #if ENABLE(SVG)
26 
27 #include "AffineTransform.h"
28 #include "FloatPoint.h"
29 #include <wtf/RefCounted.h>
30 #include <wtf/RefPtr.h>
31 
32 namespace WebCore
33 {
34 
35 class FloatSize;
36 
37 class SVGTransform
38 {
39 public:
40  enum SVGTransformType {
41  SVG_TRANSFORM_UNKNOWN = 0,
42  SVG_TRANSFORM_MATRIX = 1,
43  SVG_TRANSFORM_TRANSLATE = 2,
44  SVG_TRANSFORM_SCALE = 3,
45  SVG_TRANSFORM_ROTATE = 4,
46  SVG_TRANSFORM_SKEWX = 5,
47  SVG_TRANSFORM_SKEWY = 6
48  };
49 
50  SVGTransform();
51  SVGTransform(SVGTransformType);
52  explicit SVGTransform(const AffineTransform &);
53  virtual ~SVGTransform();
54 
55  SVGTransformType type() const;
56 
57  AffineTransform matrix() const;
58 
59  float angle() const;
60  FloatPoint rotationCenter() const;
61 
62  void setMatrix(const AffineTransform &);
63  void setTranslate(float tx, float ty);
64  void setScale(float sx, float sy);
65  void setRotate(float angle, float cx, float cy);
66  void setSkewX(float angle);
67  void setSkewY(float angle);
68 
69  // Internal use only (animation system)
70  FloatPoint translate() const;
71  FloatSize scale() const;
72 
73  bool isValid();
74 
75 private:
76  SVGTransformType m_type;
77  float m_angle;
78  FloatPoint m_center;
79  AffineTransform m_matrix;
80 };
81 
82 inline bool operator==(const SVGTransform &a, const SVGTransform &b)
83 {
84  return a.type() == b.type() && a.angle() == b.angle() && a.matrix() == b.matrix();
85 }
86 
87 inline bool operator!=(const SVGTransform &a, const SVGTransform &b)
88 {
89  return !(a == b);
90 }
91 
92 } // namespace WebCore
93 
94 #endif // ENABLE(SVG)
95 #endif
96 
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Type type(const QSqlDatabase &db)
bool isValid(QStringView ifopt)
bool operator!=(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.