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 #pragma once
12 
13 #include <vcl/dllapi.h>
14 #include <tools/gen.hxx>
15 
16 namespace vcl::pdf
17 {
18 // matrix helper class
19 // TODO: use basegfx matrix class instead or derive from it
20 
21 /* for sparse matrices of the form (2D linear transformations)
22  * f[0] f[1] 0
23  * f[2] f[3] 0
24  * f[4] f[5] 1
25  */
26 class Matrix3
27 {
28  double f[6];
29 
30  void set(const double* pn)
31  {
32  for (int i = 0; i < 6; i++)
33  f[i] = pn[i];
34  }
35 
36 public:
37  Matrix3();
38 
39  void skew(double alpha, double beta);
40  void scale(double sx, double sy);
41  void rotate(double angle);
42  void translate(double tx, double ty);
43  void invert();
44 
45  double get(size_t i) const { return f[i]; }
46 
47  Point transform(const Point& rPoint) const;
48 };
49 }
50 
51 /* 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:28
void set(const double *pn)
Definition: Matrix3.hxx:30
int i
void skew(double alpha, double beta)
Definition: Matrix3.cxx:34
Point transform(const Point &rPoint) const
Definition: Matrix3.cxx:27