QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsnullpainterdevice.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsnullpainterdevice.h
3 --------------------------------------
4 Date : December 2021
5 Copyright : (C) 2013 by Mathieu Pellerin
6 Email : nirvn dot asia at gmail 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 QGSNULLPAINTERDEVICE_H
17#define QGSNULLPAINTERDEVICE_H
18
19#include <memory>
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23
24#include <QPaintDevice>
25#include <QPaintEngine>
26
27#ifndef SIP_RUN
29class QgsNullPaintEngine : public QPaintEngine
30{
31 public:
32 QgsNullPaintEngine()
33 : QPaintEngine( QPaintEngine::AllFeatures ) {};
34
35 bool begin( QPaintDevice * ) override { return true; };
36 bool end() override { return true; };
37 QPaintEngine::Type type() const override { return QPaintEngine::User; };
38 void updateState( const QPaintEngineState & ) override { return; };
39
40 void drawRects( const QRect *, int ) override { return; };
41 void drawRects( const QRectF *, int ) override { return; };
42 void drawLines( const QLine *, int ) override { return; };
43 void drawLines( const QLineF *, int ) override { return; };
44 void drawEllipse( const QRectF & ) override { return; };
45 void drawEllipse( const QRect & ) override { return; };
46 void drawPath( const QPainterPath & ) override { return; };
47 void drawPoints( const QPointF *, int ) override { return; };
48 void drawPoints( const QPoint *, int ) override { return; };
49 void drawPolygon( const QPointF *, int, PolygonDrawMode ) override { return; };
50 void drawPolygon( const QPoint *, int, PolygonDrawMode ) override { return; };
51 void drawPixmap( const QRectF &, const QPixmap &, const QRectF & ) override { return; };
52 void drawTextItem( const QPointF &, const QTextItem & ) override { return; };
53 void drawTiledPixmap( const QRectF &, const QPixmap &, const QPointF & ) override { return; };
54 void drawImage( const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags ) override { return; };
55};
57#endif
58
59
65class CORE_EXPORT QgsNullPaintDevice : public QPaintDevice
66{
67 public:
69
70 QPaintEngine *paintEngine() const override;
71
72 int metric( PaintDeviceMetric metric ) const override;
73
77 void setOutputSize( const QSize &size ) { mSize = size; };
78
82 void setOutputDpi( const int dpi ) { mDpi = dpi; };
83
84 private:
85 std::unique_ptr<QgsNullPaintEngine> mPaintEngine;
86
87 QSize mSize;
88 int mDpi = 96;
89};
90
91
92#endif // QGSNULLPAINTERDEVICE_H
void setOutputSize(const QSize &size)
Sets the size of the device in pixels.
QPaintEngine * paintEngine() const override
int metric(PaintDeviceMetric metric) const override
void setOutputDpi(const int dpi)
Sets the dpi of the device.