QGIS API Documentation 3.39.0-Master (47f7b3a4989)
Loading...
Searching...
No Matches
qgsmaskpaintdevice.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaskpaintdevice.h
3 --------------------------------------
4 Date : February 2022
5 Copyright : (C) 2022 by Julien Cabieces
6 Email : julien dot cabieces at oslandia dot com
7 ***************************************************************************
8 * *
9 * This program 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 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSMASKPAINTDEVICE_H
17#define QGSMASKPAINTDEVICE_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21
22#include <QPainterPath>
23#include <QPaintDevice>
24#include <QPaintEngine>
25#include <memory>
26
27#ifndef SIP_RUN
29class QgsMaskPaintEngine: public QPaintEngine
30{
31
32 public:
33
34 Q_DECL_DEPRECATED QgsMaskPaintEngine( bool usePathStroker = false );
35
36 bool begin( QPaintDevice * ) override { return true; };
37 bool end() override { return true; };
38 QPaintEngine::Type type() const override { return QPaintEngine::User; };
39 void updateState( const QPaintEngineState & ) override { return; };
40
41 void drawPath( const QPainterPath & ) override;
42 void drawPolygon( const QPointF *, int, PolygonDrawMode ) override;
43 void drawPixmap( const QRectF &, const QPixmap &, const QRectF & ) override { return; };
44
45 QPainterPath maskPainterPath() const;
46
47 private:
48
49 bool mUsePathStroker = false;
50 QPainterPath mMaskPainterPath;
51
52};
54#endif
55
56
63class CORE_EXPORT QgsMaskPaintDevice: public QPaintDevice
64{
65
66 public:
67
74 Q_DECL_DEPRECATED QgsMaskPaintDevice( bool usePathStroker = false ) SIP_DEPRECATED;
75
76 QPaintEngine *paintEngine() const override;
77
78 int metric( PaintDeviceMetric metric ) const override;
79
85 Q_DECL_DEPRECATED QPainterPath maskPainterPath() const SIP_DEPRECATED;
86
87 private:
88
89 std::unique_ptr<QgsMaskPaintEngine> mPaintEngine;
90
91 QSize mSize;
92
93};
94
95
96#endif // QGSMASKPAINTDEVICE_H
Mask painter device that can be used to register everything painted into a QPainterPath used later as...
#define SIP_DEPRECATED
Definition qgis_sip.h:106