KHTML
SVGTransform.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 00003 2004, 2005 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef SVGTransform_h 00024 #define SVGTransform_h 00025 #if ENABLE(SVG) 00026 00027 #include "AffineTransform.h" 00028 #include "FloatPoint.h" 00029 #include <wtf/RefCounted.h> 00030 #include <wtf/RefPtr.h> 00031 00032 namespace WebCore { 00033 00034 class FloatSize; 00035 00036 class SVGTransform { 00037 public: 00038 enum SVGTransformType { 00039 SVG_TRANSFORM_UNKNOWN = 0, 00040 SVG_TRANSFORM_MATRIX = 1, 00041 SVG_TRANSFORM_TRANSLATE = 2, 00042 SVG_TRANSFORM_SCALE = 3, 00043 SVG_TRANSFORM_ROTATE = 4, 00044 SVG_TRANSFORM_SKEWX = 5, 00045 SVG_TRANSFORM_SKEWY = 6 00046 }; 00047 00048 SVGTransform(); 00049 SVGTransform(SVGTransformType); 00050 explicit SVGTransform(const AffineTransform&); 00051 virtual ~SVGTransform(); 00052 00053 SVGTransformType type() const; 00054 00055 AffineTransform matrix() const; 00056 00057 float angle() const; 00058 FloatPoint rotationCenter() const; 00059 00060 void setMatrix(const AffineTransform&); 00061 void setTranslate(float tx, float ty); 00062 void setScale(float sx, float sy); 00063 void setRotate(float angle, float cx, float cy); 00064 void setSkewX(float angle); 00065 void setSkewY(float angle); 00066 00067 // Internal use only (animation system) 00068 FloatPoint translate() const; 00069 FloatSize scale() const; 00070 00071 bool isValid(); 00072 00073 private: 00074 SVGTransformType m_type; 00075 float m_angle; 00076 FloatPoint m_center; 00077 AffineTransform m_matrix; 00078 }; 00079 00080 inline bool operator==(const SVGTransform& a, const SVGTransform& b) 00081 { 00082 return a.type() == b.type() && a.angle() == b.angle() && a.matrix() == b.matrix(); 00083 } 00084 00085 inline bool operator!=(const SVGTransform& a, const SVGTransform& b) 00086 { 00087 return !(a == b); 00088 } 00089 00090 } // namespace WebCore 00091 00092 #endif // ENABLE(SVG) 00093 #endif 00094 00095 // vim:ts=4:noet
KDE 4.6 API Reference