| 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 | #pragma once |
| 23 | |
| 24 | // TODO: Rename this file to PathPaintDevice.h |
| 25 | |
| 26 | #include <QPaintDevice> |
| 27 | #include <QList> |
| 28 | #include <QPolygonF> |
| 29 | #include <QSet> |
| 30 | |
| 31 | class PathPaintEnginecxx . . $ PathPaintEngine#; |
| 32 | |
| 33 | // Needed for QSet<QPolygonF>. Simply concatenates all the coordinates in a QByteArray and hashes that. |
| 34 | uintcxx . . $ uint# qHashcxx . . $ qHash(bbc8c951ad6340fb).(const QPolygonFcxx . . $ QPolygonF#& key); |
| 35 | |
| 36 | class PathPaintDevicecxx . . $ PathPaintDevice# : public QPaintDevicecxx . . $ QPaintDevice# |
| 37 | { |
| 38 | public: |
| 39 | PathPaintDevicecxx . . $ PathPaintDevice#PathPaintDevice(98dd472ac7e5c3d4).(double widthInMm, double heightInMm, double pixelsPerMm = 90.0/25.4); |
| 40 | ~cxx . . $ PathPaintDevice#`~PathPaintDevice`(49f6e7a06ebc5aa8).PathPaintDevicecxx . . $ PathPaintDevice#(); |
| 41 | |
| 42 | // Adds a path to the device. |
| 43 | // Also automatically ignores duplicate paths, which QSvgPainter creates (I guess for the fill and stroke). |
| 44 | // Paths are clipped (horribly) to the page. And if any are clipped, clipped() returns true. |
| 45 | void addPathcxx . . $ PathPaintDevice#addPath(e790b6e62144e8f9).(const QPolygonFcxx . . $ QPolygonF#& path); |
| 46 | |
| 47 | // Get a list of paths. |
| 48 | QListcxx . . $ QList#<QPolygonFcxx . . $ QPolygonF#> pathscxx . . $ PathPaintDevice#paths(90068b3bf70c4f3b).(); |
| 49 | |
| 50 | // Returns true if any paths had to be clipped. |
| 51 | bool clippedcxx . . $ PathPaintDevice#clipped(50ce9a9e25b4a850).() const; |
| 52 | |
| 53 | QPaintEnginecxx . . $ QPaintEngine#* paintEnginecxx . . $ PathPaintDevice#paintEngine(8adfa229aa3b0486).() const; |
| 54 | |
| 55 | |
| 56 | protected: |
| 57 | int metriccxx . . $ PathPaintDevice#metric(53a2adb47504e1c8).(PaintDeviceMetriccxx . . $ QPaintDevice#PaintDeviceMetric# metric) const; |
| 58 | private: |
| 59 | mutable PathPaintEnginecxx . . $ PathPaintEngine#* enginecxx . . $ PathPaintDevice#engine.; |
| 60 | |
| 61 | // The paths added. |
| 62 | QListcxx . . $ QList#<QPolygonFcxx . . $ QPolygonF#> pagePathscxx . . $ PathPaintDevice#pagePaths.; |
| 63 | // Set of paths, so we can detect duplicates. |
| 64 | QSetcxx . . $ QSet#<QPolygonFcxx . . $ QPolygonF#> pagePathSetcxx . . $ PathPaintDevice#pagePathSet.; |
| 65 | |
| 66 | bool pathsClippedcxx . . $ PathPaintDevice#pathsClipped.; |
| 67 | |
| 68 | double widthcxx . . $ PathPaintDevice#width.; |
| 69 | double heightcxx . . $ PathPaintDevice#height.; |
| 70 | |
| 71 | double ppmcxx . . $ PathPaintDevice#ppm.; |
| 72 | }; |