00001 #ifndef _LIBGNOMECANVASMM_AFFINETRANS_H
00002 #define _LIBGNOMECANVASMM_AFFINETRANS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <glibmm/containers.h>
00027 #include <libgnomecanvasmm/point.h>
00028
00029 namespace Gnome
00030 {
00031
00032 namespace Art
00033 {
00034
00035
00036 class AffineTrans
00037 {
00038 public:
00039
00040 AffineTrans(double scale = 1.0);
00041
00042
00043 explicit AffineTrans(const double aff[6]);
00044
00045 AffineTrans(const AffineTrans& src);
00046 AffineTrans& operator=(const AffineTrans& src);
00047 ~AffineTrans();
00048
00049 double& operator[](unsigned int idx);
00050 const double& operator[](unsigned int idx) const;
00051
00052 double* gobj();
00053 const double* gobj() const;
00054
00055
00056
00057
00058
00059
00060 Point apply_to(const Point& p) const;
00061
00062
00063 Point operator*(const Point& p) const;
00064
00065
00066 AffineTrans operator*(const AffineTrans& aff2);
00067
00068
00069 AffineTrans const & operator*=(AffineTrans& other);
00070
00071 bool operator==(const AffineTrans& other) const;
00072 bool operator!=(const AffineTrans& other) const;
00073
00074
00075 void invert();
00076
00077
00078 void flip(bool horiz, bool vert);
00079
00080
00081 bool rectilinear() const;
00082
00083
00084 double expansion() const;
00085
00086
00087 static AffineTrans identity();
00088
00089
00090 static AffineTrans scaling(double s);
00091
00092
00093 static AffineTrans scaling(double sx, double sy);
00094
00095
00096 static AffineTrans rotation(double theta);
00097
00098
00099 static AffineTrans shearing(double theta);
00100
00101
00102 static AffineTrans translation(double dx, double dy);
00103
00104
00105 static AffineTrans translation(const Point& p);
00106
00107 Glib::ustring to_string() const;
00108
00109 protected:
00110 double trans_[6];
00111 };
00112
00113 }
00114
00115 }
00116
00117 std::ostream& operator<<(std::ostream& out, const Gnome::Art::AffineTrans& aff);
00118
00119 #endif // _GNOMEMM_AFFINETRANS_H