Seamly2D
Code documentation
vobjengine.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vobjengine.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 12 12, 2014
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2013-2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef VOBJENGINE_H
53 #define VOBJENGINE_H
54 
55 #include <qcompilerdetection.h>
56 #include <QTransform>
57 #include <QPaintEngine>
58 #include <QPolygonF>
59 #include <QRectF>
60 #include <QSharedPointer>
61 #include <QSize>
62 #include <QtGlobal>
63 
64 #include "delaunay.h"
65 
66 class QTextStream;
67 
68 #define MAX_POINTS 512
69 
70 class VObjEngine : public QPaintEngine
71 {
72 public:
73  VObjEngine();
74  virtual ~VObjEngine() Q_DECL_OVERRIDE;
75 
76  virtual bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
77  virtual bool end() Q_DECL_OVERRIDE;
78  virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;
79  virtual void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE;
80  virtual Type type() const Q_DECL_OVERRIDE;
81  virtual void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
82  virtual void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE;
83  virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
84  virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
85  virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
86 
87  QSize getSize() const;
88  void setSize(const QSize &value);
89 
90  QIODevice *getOutputDevice() const;
91  void setOutputDevice(QIODevice *value);
92 
93  int getResolution() const;
94  void setResolution(int value);
95 
96 private:
97  Q_DISABLE_COPY(VObjEngine)
98  QSharedPointer<QTextStream> stream;
102  quint32 planeCount;
103  QSize size;
105  QTransform transform;
106 
107  QPolygonF MakePointsUnique(const QPolygonF &polygon)const;
108  qint64 Square(const QPolygonF &poly)const;
109 };
110 
111 #endif // VOBJENGINE_H
virtual void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:188
int resolution
Definition: vobjengine.h:104
void setOutputDevice(QIODevice *value)
Definition: vobjengine.cpp:334
virtual void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:286
int getResolution() const
Definition: vobjengine.cpp:341
virtual ~VObjEngine() Q_DECL_OVERRIDE
Definition: vobjengine.cpp:123
QTransform transform
Definition: vobjengine.h:105
virtual bool end() Q_DECL_OVERRIDE
Definition: vobjengine.cpp:165
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:307
qint64 Square(const QPolygonF &poly) const
Definition: vobjengine.cpp:370
virtual Type type() const Q_DECL_OVERRIDE
Definition: vobjengine.cpp:280
QSize getSize() const
Definition: vobjengine.cpp:315
quint32 planeCount
Definition: vobjengine.h:102
QPolygonF MakePointsUnique(const QPolygonF &polygon) const
Definition: vobjengine.cpp:354
virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE
virtual bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:128
virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:173
QSharedPointer< QIODevice > outputDevice
Definition: vobjengine.h:100
void setSize(const QSize &value)
Definition: vobjengine.cpp:321
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE
Definition: vobjengine.cpp:259
quint32 globalPointsCount
Definition: vobjengine.h:99
QIODevice * getOutputDevice() const
Definition: vobjengine.cpp:328
del_point2d_t points[512]
Definition: vobjengine.h:101
QSharedPointer< QTextStream > stream
Definition: vobjengine.h:98
QSize size
Definition: vobjengine.h:103
void setResolution(int value)
Definition: vobjengine.cpp:347
#define MAX_POINTS
Definition: vobjengine.h:68