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>
15#include <tools/gen.hxx>
16
17namespace 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 */
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
37public:
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 DevicePoint transform(const DevicePoint& rPoint) const;
50};
51}
52
53/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void translate(double tx, double ty)
Definition: Matrix3.cxx:85
Point transform(const Point &rPoint) const
Definition: Matrix3.cxx:27
double f[6]
Definition: Matrix3.hxx:29
void rotate(double angle)
Definition: Matrix3.cxx:71
double get(size_t i) const
Definition: Matrix3.hxx:46
void set(const double *pn)
Definition: Matrix3.hxx:31
void scale(double sx, double sy)
Definition: Matrix3.cxx:59
void skew(double alpha, double beta)
Definition: Matrix3.cxx:39
int i