KHTML
AffineTransform.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
00024
00025
00026 #ifndef AffineTransform_h
00027 #define AffineTransform_h
00028
00029 #if PLATFORM(CG)
00030 #include <CoreGraphics/CGAffineTransform.h>
00031 #elif PLATFORM(QT)
00032 #include <QMatrix>
00033 #elif PLATFORM(CAIRO)
00034 #include <cairo.h>
00035 #elif PLATFORM(WX) && USE(WXGC)
00036 #include <wx/defs.h>
00037 #include <wx/graphics.h>
00038 #endif
00039
00040 namespace WebCore {
00041
00042 class IntPoint;
00043 class IntRect;
00044 class FloatPoint;
00045 class FloatRect;
00046
00047 class AffineTransform {
00048 public:
00049 AffineTransform();
00050 AffineTransform(double a, double b, double c, double d, double e, double f);
00051 #if PLATFORM(CG)
00052 AffineTransform(CGAffineTransform transform);
00053 #elif PLATFORM(QT)
00054 AffineTransform(const QMatrix &matrix);
00055 #elif PLATFORM(CAIRO)
00056 AffineTransform(const cairo_matrix_t &matrix);
00057 #elif PLATFORM(WX) && USE(WXGC)
00058 AffineTransform(const wxGraphicsMatrix &matrix);
00059 #endif
00060
00061 void setMatrix(double a, double b, double c, double d, double e, double f);
00062 void map(double x, double y, double *x2, double *y2) const;
00063 IntPoint mapPoint(const IntPoint&) const;
00064 FloatPoint mapPoint(const FloatPoint&) const;
00065 IntRect mapRect(const IntRect&) const;
00066 FloatRect mapRect(const FloatRect&) const;
00067
00068 bool isIdentity() const;
00069
00070 double a() const;
00071 void setA(double a);
00072
00073 double b() const;
00074 void setB(double b);
00075
00076 double c() const;
00077 void setC(double c);
00078
00079 double d() const;
00080 void setD(double d);
00081
00082 double e() const;
00083 void setE(double e);
00084
00085 double f() const;
00086 void setF(double f);
00087
00088 void reset();
00089
00090 AffineTransform& multiply(const AffineTransform&);
00091 AffineTransform& scale(double);
00092 AffineTransform& scale(double sx, double sy);
00093 AffineTransform& scaleNonUniform(double sx, double sy);
00094 AffineTransform& rotate(double d);
00095 AffineTransform& rotateFromVector(double x, double y);
00096 AffineTransform& translate(double tx, double ty);
00097 AffineTransform& shear(double sx, double sy);
00098 AffineTransform& flipX();
00099 AffineTransform& flipY();
00100 AffineTransform& skew(double angleX, double angleY);
00101 AffineTransform& skewX(double angle);
00102 AffineTransform& skewY(double angle);
00103
00104 double det() const;
00105 bool isInvertible() const;
00106 AffineTransform inverse() const;
00107
00108 #if PLATFORM(CG)
00109 operator CGAffineTransform() const;
00110 #elif PLATFORM(QT)
00111 operator QMatrix() const;
00112 #elif PLATFORM(CAIRO)
00113 operator cairo_matrix_t() const;
00114 #elif PLATFORM(WX) && USE(WXGC)
00115 operator wxGraphicsMatrix() const;
00116 #endif
00117
00118 bool operator==(const AffineTransform&) const;
00119 bool operator!=(const AffineTransform& other) const { return !(*this == other); }
00120 AffineTransform& operator*=(const AffineTransform&);
00121 AffineTransform operator*(const AffineTransform&);
00122
00123 private:
00124 #if PLATFORM(CG)
00125 CGAffineTransform m_transform;
00126 #elif PLATFORM(QT)
00127 QMatrix m_transform;
00128 #elif PLATFORM(CAIRO)
00129 cairo_matrix_t m_transform;
00130 #elif PLATFORM(WX) && USE(WXGC)
00131 wxGraphicsMatrix m_transform;
00132 #endif
00133 };
00134
00135 }
00136
00137 #endif // AffineTransform_h