CDRTransforms.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libcdr
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
17  *
18  * All Rights Reserved.
19  *
20  * For minor contributions see the git repository.
21  *
22  * Alternatively, the contents of this file may be used under the terms of
23  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26  * instead of those above.
27  */
28 
29 #ifndef __CDRTRANSFORMS_H__
30 #define __CDRTRANSFORMS_H__
31 
32 #include <vector>
33 #include <math.h>
34 
35 namespace libcdr
36 {
37 class CDRPath;
38 
40 {
41 public:
42  CDRTransform();
43  CDRTransform(double v0, double v1, double x0, double v3, double v4, double y0);
44  CDRTransform(const CDRTransform &trafo);
45 
46  void applyToPoint(double &x, double &y) const;
47  void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const;
48  double getScaleX() const;
49  double getScaleY() const;
50  double getTranslateX() const;
51  double getTranslateY() const;
52  bool getFlipX() const;
53  bool getFlipY() const;
54 
55 private:
56  double _getScaleX() const;
57  double _getScaleY() const;
58  double m_v0;
59  double m_v1;
60  double m_x0;
61  double m_v3;
62  double m_v4;
63  double m_y0;
64 };
65 
67 {
68 public:
69  CDRTransforms();
70  CDRTransforms(const CDRTransforms &trafos);
72 
73  void append(double v0, double v1, double x0, double v3, double v4, double y0);
74  void append(const CDRTransform &trafo);
75  void clear();
76  bool empty() const;
77 
78  void applyToPoint(double &x, double &y) const;
79  void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const;
80  double getScaleX() const;
81  double getScaleY() const;
82  double getTranslateX() const;
83  double getTranslateY() const;
84  bool getFlipX() const;
85  bool getFlipY() const;
86 
87 private:
88  double _getScaleX() const;
89  double _getScaleY() const;
90  std::vector<CDRTransform> m_trafos;
91 };
92 
93 } // namespace libcdr
94 
95 #endif /* __CDRTRANSFORMS_H__ */
96 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libcdr by doxygen 1.8.1.2