KHTML
SVGTransform.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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 }
00091
00092 #endif // ENABLE(SVG)
00093 #endif
00094
00095