LibreOffice Module vcl (master)  1
Matrix3.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  */
10 
11 #ifndef INCLUDED_VCL_INC_PDF_MATRIX3_HXX
12 #define INCLUDED_VCL_INC_PDF_MATRIX3_HXX
13 
14 #include <vcl/dllapi.h>
15 #include <tools/gen.hxx>
16 
17 namespace vcl::pdf
18 {
19 // matrix helper class
20 // TODO: use basegfx matrix class instead or derive from it
21 
22 /* for sparse matrices of the form (2D linear transformations)
23  * f[0] f[1] 0
24  * f[2] f[3] 0
25  * f[4] f[5] 1
26  */
27 class Matrix3
28 {
29  double f[6];
30 
31  void set(const double* pn)
32  {
33  for (int i = 0; i < 6; i++)
34  f[i] = pn[i];
35  }
36 
37 public:
38  Matrix3();
39 
40  void skew(double alpha, double beta);
41  void scale(double sx, double sy);
42  void rotate(double angle);
43  void translate(double tx, double ty);
44  void invert();
45 
46  double get(size_t i) const { return f[i]; }
47 
48  Point transform(const Point& rPoint) const;
49 };
50 }
51 
52 #endif
53 
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void rotate(double angle)
Definition: Matrix3.cxx:66
void scale(double sx, double sy)
Definition: Matrix3.cxx:54
void translate(double tx, double ty)
Definition: Matrix3.cxx:80
double f[6]
Definition: Matrix3.hxx:29
void set(const double *pn)
Definition: Matrix3.hxx:31
int i
void skew(double alpha, double beta)
Definition: Matrix3.cxx:34
Point transform(const Point &rPoint) const
Definition: Matrix3.cxx:27