Debian Codegraph @

PathPaintPage.cpp

raw symbols SCIP
1 /***************************************************************************
2 * This file is part of Robocut. *
3 * Copyright (C) 2010 Tim Hutt <[email protected]> *
4 * Copyright (C) 2010 Markus Schulz <[email protected]> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
20 ***************************************************************************/
21
22 #include "PathPaintPage.h"cxx . . $ `<file>/PathPaintPage.h`/
23
24 #include "PathPaintEngine.h"cxx . . $ `<file>/PathPaintEngine.h`/
25
26 #include <QDebug>
27
28
29
30 uintcxx . . $ uint# qHashcxx . . $ qHash(bbc8c951ad6340fb).(const QPolygonFcxx . . $ QPolygonF#& key)
31 {
32 QByteArraycxx . . $ QByteArray# reprcxx . . $ QByteArray#QByteArray(49f6e7a06ebc5aa8).;
33 for (int i = 0; i < key.sizecxx . . $ QVector#size(455f465bc33b4cdf).(); ++i)
34 {
35 double x = key[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).i].xcxx . . $ QPointF#x(21b6c25e127938e2).();
36 double y = key[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).i].ycxx . . $ QPointF#y(21b6c25e127938e2).();
37
38 repr.appendcxx . . $ QByteArray#append(55312efaea0f3795).(reinterpret_cast<char*>(&x), sizeof(x));
39 repr.appendcxx . . $ QByteArray#append(55312efaea0f3795).(reinterpret_cast<char*>(&y), sizeof(y));
40 }
41 return qHashcxx . . $ qHash(fa24e691509f096a).(repr);
42 }
43
44
45
46 PathPaintDevicecxx . . $ PathPaintDevice#::PathPaintDevicecxx . . $ PathPaintDevice#PathPaintDevice(98dd472ac7e5c3d4).(double widthInMm, double heightInMm, double pixelsPerMm)
47 {
48 enginecxx . . $ PathPaintDevice#engine. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
49 widthcxx . . $ PathPaintDevice#width. = widthInMm;
50 heightcxx . . $ PathPaintDevice#height. = heightInMm;
51 pathsClippedcxx . . $ PathPaintDevice#pathsClipped. = false;
52 ppmcxx . . $ PathPaintDevice#ppm. = pixelsPerMm;
53 if (ppmcxx . . $ PathPaintDevice#ppm. == 0.0)
54 ppmcxx . . $ PathPaintDevice#ppm. = 1.0;
55 }
56
57 PathPaintDevicecxx . . $ PathPaintDevice#::~cxx . . $ PathPaintDevice#`~PathPaintDevice`(49f6e7a06ebc5aa8).PathPaintDevicecxx . . $ PathPaintDevice#()
58 {
59 if (enginecxx . . $ PathPaintDevice#engine.)
60 delete enginecxx . . $ PathPaintDevice#engine.;
61 }
62
63 void PathPaintDevicecxx . . $ PathPaintDevice#::addPathcxx . . $ PathPaintDevice#addPath(e790b6e62144e8f9).(const QPolygonFcxx . . $ QPolygonF#& path)
64 {
65 if (pagePathSetcxx . . $ PathPaintDevice#pagePathSet..containscxx . . $ QSet#contains(8877ebe272b9620d).(path))
66 return;
67 pagePathSetcxx . . $ PathPaintDevice#pagePathSet..insertcxx . . $ QSet#insert(b1720532d625d779).(path);
68 pagePathscxx . . $ PathPaintDevice#pagePaths..appendcxx . . $ QList#append(77d9f17553126ecb).(path);
69
70 // Clip the path.
71 for (int j = 0; j < pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).().sizecxx . . $ QVector#size(455f465bc33b4cdf).(); ++j)
72 {
73 // pagePaths are in mm, so convert from pixels to mm.
74 pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j] /=cxx . . $ QPointF#`operator/=`(82df65ffd9cc3fb3). ppmcxx . . $ PathPaintDevice#ppm.;
75
76 if (pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].xcxx . . $ QPointF#x(21b6c25e127938e2).() < 0.0)
77 {
78 pathsClippedcxx . . $ PathPaintDevice#pathsClipped. = true;
79 pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].setXcxx . . $ QPointF#setX(ba8836b59fb42830).(0.0);
80 }
81 if (pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].ycxx . . $ QPointF#y(21b6c25e127938e2).() < 0.0)
82 {
83 pathsClippedcxx . . $ PathPaintDevice#pathsClipped. = true;
84 pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].setYcxx . . $ QPointF#setY(ba8836b59fb42830).(0.0);
85 }
86 if (pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].xcxx . . $ QPointF#x(21b6c25e127938e2).() > widthcxx . . $ PathPaintDevice#width.)
87 {
88 pathsClippedcxx . . $ PathPaintDevice#pathsClipped. = true;
89 pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].setXcxx . . $ QPointF#setX(ba8836b59fb42830).(widthcxx . . $ PathPaintDevice#width.);
90 }
91 if (pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].ycxx . . $ QPointF#y(21b6c25e127938e2).() > heightcxx . . $ PathPaintDevice#height.)
92 {
93 pathsClippedcxx . . $ PathPaintDevice#pathsClipped. = true;
94 pagePathscxx . . $ PathPaintDevice#pagePaths..backcxx . . $ QList#back(19b2b6f17af048b).()[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).j].setYcxx . . $ QPointF#setY(ba8836b59fb42830).(heightcxx . . $ PathPaintDevice#height.);
95 }
96 }
97
98 }
99
100 QPaintEnginecxx . . $ QPaintEngine#* PathPaintDevicecxx . . $ PathPaintDevice#::paintEnginecxx . . $ PathPaintDevice#paintEngine(8adfa229aa3b0486).() const
101 {
102 if (!enginecxx . . $ PathPaintDevice#engine.)
103 enginecxx . . $ PathPaintDevice#engine. = new PathPaintEnginecxx . . $ PathPaintEngine#PathPaintEngine(dd2eedc069b0ab5f).(const_cast<PathPaintDevicecxx . . $ PathPaintDevice#*>(this));
104 return enginecxx . . $ PathPaintDevice#engine.;
105 }
106
107 QListcxx . . $ QList#<QPolygonFcxx . . $ QPolygonF#> PathPaintDevicecxx . . $ PathPaintDevice#::pathscxx . . $ PathPaintDevice#paths(90068b3bf70c4f3b).()
108 {
109 return pagePathscxx . . $ QList#QList(3d2301cfd89f773a).;
110 }
111
112 int PathPaintDevicecxx . . $ PathPaintDevice#::metriccxx . . $ PathPaintDevice#metric(53a2adb47504e1c8).(PaintDeviceMetriccxx . . $ QPaintDevice#PaintDeviceMetric# metric) const
113 {
114 switch (metric)
115 {
116 // Width in pixels.
117 case PdmWidthcxx . . $ QPaintDevice#PdmWidth.:
118 return widthcxx . . $ PathPaintDevice#width. * ppmcxx . . $ PathPaintDevice#ppm.;
119 case PdmHeightcxx . . $ QPaintDevice#PdmHeight.:
120 return heightcxx . . $ PathPaintDevice#height. * ppmcxx . . $ PathPaintDevice#ppm.;
121 case PdmWidthMMcxx . . $ QPaintDevice#PdmWidthMM.:
122 return widthcxx . . $ PathPaintDevice#width.;
123 case PdmHeightMMcxx . . $ QPaintDevice#PdmHeightMM.:
124 return heightcxx . . $ PathPaintDevice#height.;
125 case PdmNumColorscxx . . $ QPaintDevice#PdmNumColors.:
126 return 2;
127 case PdmDepthcxx . . $ QPaintDevice#PdmDepth.:
128 return 1;
129 case PdmDpiXcxx . . $ QPaintDevice#PdmDpiX.:
130 return 25.4 * ppmcxx . . $ PathPaintDevice#ppm.; // Convert to inches.
131 case PdmDpiYcxx . . $ QPaintDevice#PdmDpiY.:
132 return 25.4 * ppmcxx . . $ PathPaintDevice#ppm.;
133 case PdmPhysicalDpiXcxx . . $ QPaintDevice#PdmPhysicalDpiX.:
134 return 25.4 * ppmcxx . . $ PathPaintDevice#ppm.;
135 case PdmPhysicalDpiYcxx . . $ QPaintDevice#PdmPhysicalDpiY.:
136 return 25.4 * ppmcxx . . $ PathPaintDevice#ppm.;
137 }
138 return 0;
139 }
140
141 bool PathPaintDevicecxx . . $ PathPaintDevice#::clippedcxx . . $ PathPaintDevice#clipped(50ce9a9e25b4a850).() const
142 {
143 return pathsClippedcxx . . $ PathPaintDevice#pathsClipped.;
144 }