QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsnullpainterdevice.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsnullpainterdevice.cpp
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
17
18
20{
21 mPaintEngine = std::make_unique<QgsNullPaintEngine>();
22}
23
25{
26 return mPaintEngine.get();
27}
28
29int QgsNullPaintDevice::metric( PaintDeviceMetric metric ) const
30{
31 switch ( metric )
32 {
33 case QPaintDevice::PdmWidth:
34 return mSize.width();
35 case QPaintDevice::PdmHeight:
36 return mSize.height();
37 case QPaintDevice::PdmWidthMM:
38 return mSize.width();
39 case QPaintDevice::PdmHeightMM:
40 return mSize.height();
41 case QPaintDevice::PdmNumColors:
42 return std::numeric_limits<int>::max();
43 case QPaintDevice::PdmDepth:
44 return 32;
45 case QPaintDevice::PdmDpiX:
46 case QPaintDevice::PdmDpiY:
47 case QPaintDevice::PdmPhysicalDpiX:
48 case QPaintDevice::PdmPhysicalDpiY:
49 return mDpi;
50 case QPaintDevice::PdmDevicePixelRatio:
51 return 1;
52 case QPaintDevice::PdmDevicePixelRatioScaled:
53 return 1;
54 }
55 return 0;
56}
QPaintEngine * paintEngine() const override
int metric(PaintDeviceMetric metric) const override