# matrix.h

Go to the documentation of this file.

    00001 /* Copyright (C) 2008 Jonathon Jongsma
    00002  *
    00003  * This library is free software; you can redistribute it and/or
    00004  * modify it under the terms of the GNU Library General Public
    00005  * License as published by the Free Software Foundation; either
    00006  * version 2 of the License, or (at your option) any later version.
    00007  *
    00008  * This library is distributed in the hope that it will be useful,
    00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011  * Library General Public License for more details.
    00012  *
    00013  * You should have received a copy of the GNU Library General Public
    00014  * License along with this library; if not, write to the Free Software
    00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    00016  * 02110-1301, USA.
    00017  */
    00018 #ifndef __CAIROMM_MATRIX_H
    00019 #define __CAIROMM_MATRIX_H
    00020
    00021 #include <cairo.h>
    00022
    00023 namespace Cairo
    00024 {
    00025
    00050 class Matrix : public cairo_matrix_t
    00051 {
    00052 public:
    00063   Matrix();
    00064
    00080   Matrix(double xx, double yx, double xy, double yy, double x0, double y0);
    00081
    00089   void translate(double tx, double ty);
    00090
    00098   void scale(double sx, double sy);
    00099
    00109   void rotate(double radians);
    00110
    00116   void invert(); // throws exception
    00117
    00130   void multiply(Matrix& a, Matrix& b);
    00131
    00150   void transform_distance(double& dx, double& dy) const;
    00151
    00157   void transform_point(double& x, double& y) const;
    00158 };
    00159
    00164 Matrix identity_matrix();
    00165
    00174 Matrix translation_matrix(double tx, double ty);
    00175
    00184 Matrix scaling_matrix(double sx, double sy);
    00185
    00195 Matrix rotation_matrix(double radians);
    00196
    00209 Matrix operator*(const Matrix& a, const Matrix& b);
    00210
    00211 } // namespace Cairo
    00212
    00213 #endif // __CAIROMM_MATRIX_H