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
00027 #ifndef BTAffineTransform_h
00028 #define BTAffineTransform_h
00029
00030 #if PLATFORM(CG)
00031 #include <ApplicationServices/ApplicationServices.h>
00032 #elif PLATFORM(QT)
00033 #include <QMatrix>
00034 #elif PLATFORM(CAIRO)
00035 #include "cairo.h"
00036 #endif
00037
00038 namespace WebCore {
00039
00040 class IntPoint;
00041 class IntRect;
00042 class FloatRect;
00043
00044 #ifdef __OWB__
00045 }
00046
00047 using WebCore::IntPoint;
00048 using WebCore::IntRect;
00049 using WebCore::FloatRect;
00050 namespace BAL {
00051 #endif
00052
00053 class BTAffineTransform {
00054 public:
00055 BTAffineTransform();
00056 BTAffineTransform(double a, double b, double c, double d, double e, double f);
00057 #if PLATFORM(CG)
00058 BTAffineTransform(CGAffineTransform transform);
00059 #elif PLATFORM(QT)
00060 BTAffineTransform(const QMatrix &matrix);
00061 #elif PLATFORM(CAIRO)
00062 BTAffineTransform(const cairo_matrix_t &matrix);
00063 #endif
00064
00065 void setMatrix(double a, double b, double c, double d, double e, double f);
00066 void map(double x, double y, double *x2, double *y2) const;
00067 IntPoint mapPoint(const IntPoint&) const;
00068 IntRect mapRect(const IntRect&) const;
00069 FloatRect mapRect(const FloatRect&) const;
00070
00071 bool isIdentity() const;
00072
00073 double a() const;
00074 void setA(double a);
00075
00076 double b() const;
00077 void setB(double b);
00078
00079 double c() const;
00080 void setC(double c);
00081
00082 double d() const;
00083 void setD(double d);
00084
00085 double e() const;
00086 void setE(double e);
00087
00088 double f() const;
00089 void setF(double f);
00090
00091 void reset();
00092
00093 BTAffineTransform& multiply(const BTAffineTransform&);
00094 BTAffineTransform& scale(double);
00095 BTAffineTransform& scale(double sx, double sy);
00096 BTAffineTransform& scaleNonUniform(double sx, double sy);
00097 BTAffineTransform& rotate(double d);
00098 BTAffineTransform& rotateFromVector(double x, double y);
00099 BTAffineTransform& translate(double tx, double ty);
00100 BTAffineTransform& shear(double sx, double sy);
00101 BTAffineTransform& flipX();
00102 BTAffineTransform& flipY();
00103 BTAffineTransform& skew(double angleX, double angleY);
00104 BTAffineTransform& skewX(double angle);
00105 BTAffineTransform& skewY(double angle);
00106
00107 double det() const;
00108 bool isInvertible() const;
00109 BTAffineTransform inverse() const;
00110
00111 #if PLATFORM(CG)
00112 operator CGAffineTransform() const;
00113 #elif PLATFORM(QT)
00114 operator QMatrix() const;
00115 #elif PLATFORM(CAIRO)
00116 operator cairo_matrix_t() const;
00117 #endif
00118
00119 bool operator==(const BTAffineTransform&) const;
00120 BTAffineTransform& operator*=(const BTAffineTransform&);
00121 BTAffineTransform operator*(const BTAffineTransform&);
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 defined __OWB__
00131 double m_m11;
00132 double m_m12;
00133 double m_m21;
00134 double m_m22;
00135 double m_dx;
00136 double m_dy;
00137 #endif
00138 };
00139
00140 }
00141
00142 #endif // BTAffineTransform_h