2
KDChart - a multi-platform charting engine
5
/****************************************************************************
6
** Copyright (C) 2009 Klaralvdalens Datakonsult AB. All rights reserved.
8
** This file is part of the KD Chart library.
10
** This file may be used under the terms of the GNU General Public
11
** License versions 2.0 or 3.0 as published by the Free Software
12
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
13
** included in the packaging of this file. Alternatively you may (at
14
** your option) use any later version of the GNU General Public
15
** License if such license has been publicly approved by
16
** Klarälvdalens Datakonsult AB (or its successors, if any).
18
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
19
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
20
** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
21
** not expressly granted herein.
23
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26
**********************************************************************/
28
#ifndef NULL_PAINT_DEVICE_H
29
#define NULL_PAINT_DEVICE_H
31
#include <QPaintDevice>
32
#include <QPaintEngine>
36
class NullPaintEngine : public QPaintEngine
39
virtual bool begin(QPaintDevice * /*pdev*/) { return true; }
40
virtual void drawEllipse(const QRectF & /*rect*/) { }
41
virtual void drawEllipse(const QRect & /*rect*/) { }
42
virtual void drawImage(const QRectF & /*rectangle*/, const QImage & /*image*/, const QRectF & /*sr*/, Qt::ImageConversionFlags /*flags*/) { }
43
virtual void drawLines(const QLineF * /*lines*/, int /*lineCount*/) { }
44
virtual void drawLines(const QLine * /*lines*/, int /*lineCount*/) { }
45
virtual void drawPath(const QPainterPath & /*path*/) { }
46
virtual void drawPixmap(const QRectF & /*r*/, const QPixmap & /*pm*/, const QRectF & /*sr*/) { }
47
virtual void drawPoints(const QPointF * /*points*/, int /*pointCount*/) { }
48
virtual void drawPoints(const QPoint * /*points*/, int /*pointCount*/) { }
49
virtual void drawPolygon(const QPointF * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
50
virtual void drawPolygon(const QPoint * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
51
virtual void drawRects(const QRectF * /*rects*/, int /*rectCount*/) { }
52
virtual void drawRects(const QRect * /*rects*/, int /*rectCount*/) { }
53
virtual void drawTextItem(const QPointF & /*p*/, const QTextItem & /*textItem*/) { }
54
virtual void drawTiledPixmap(const QRectF & /*rect*/, const QPixmap & /*pixmap*/, const QPointF & /*p*/) { }
55
virtual bool end() { return true; }
57
virtual Type type() const { return QPaintEngine::User; }
58
virtual void updateState(const QPaintEngineState & /*state*/) { }
61
class NullPaintDevice : public QPaintDevice
64
NullPaintDevice(const QSize& size) : m_size(size) { }
65
~NullPaintDevice() { }
67
int metric(PaintDeviceMetric metric) const
71
case QPaintDevice::PdmWidth:
72
return m_size.width();
73
case QPaintDevice::PdmHeight:
74
return m_size.height();
75
case QPaintDevice::PdmWidthMM:
77
case QPaintDevice::PdmHeightMM:
79
case QPaintDevice::PdmNumColors:
80
return int((uint)(-1));
81
case QPaintDevice::PdmDepth:
83
case QPaintDevice::PdmDpiX:
85
case QPaintDevice::PdmDpiY:
87
case QPaintDevice::PdmPhysicalDpiX:
89
case QPaintDevice::PdmPhysicalDpiY:
95
QPaintEngine* paintEngine() const
97
static NullPaintEngine nullPaintEngine;
98
return &nullPaintEngine;