KChart

KChartNullPaintDevice.h
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef NULL_PAINT_DEVICE_H
10#define NULL_PAINT_DEVICE_H
11
12#include <QPaintDevice>
13#include <QPaintEngine>
14
15namespace KChart
16{
17 class NullPaintEngine : public QPaintEngine
18 {
19 public:
20 virtual bool begin(QPaintDevice * /*pdev*/) { return true; }
21 virtual void drawEllipse(const QRectF & /*rect*/) { }
22 virtual void drawEllipse(const QRect & /*rect*/) { }
23 virtual void drawImage(const QRectF & /*rectangle*/, const QImage & /*image*/, const QRectF & /*sr*/, Qt::ImageConversionFlags /*flags*/) { }
24 virtual void drawLines(const QLineF * /*lines*/, int /*lineCount*/) { }
25 virtual void drawLines(const QLine * /*lines*/, int /*lineCount*/) { }
26 virtual void drawPath(const QPainterPath & /*path*/) { }
27 virtual void drawPixmap(const QRectF & /*r*/, const QPixmap & /*pm*/, const QRectF & /*sr*/) { }
28 virtual void drawPoints(const QPointF * /*points*/, int /*pointCount*/) { }
29 virtual void drawPoints(const QPoint * /*points*/, int /*pointCount*/) { }
30 virtual void drawPolygon(const QPointF * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
31 virtual void drawPolygon(const QPoint * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
32 virtual void drawRects(const QRectF * /*rects*/, int /*rectCount*/) { }
33 virtual void drawRects(const QRect * /*rects*/, int /*rectCount*/) { }
34 virtual void drawTextItem(const QPointF & /*p*/, const QTextItem & /*textItem*/) { }
35 virtual void drawTiledPixmap(const QRectF & /*rect*/, const QPixmap & /*pixmap*/, const QPointF & /*p*/) { }
36 virtual bool end() { return true; }
37
38 virtual Type type() const { return QPaintEngine::User; }
39 virtual void updateState(const QPaintEngineState & /*state*/) { }
40 };
41
42 class NullPaintDevice : public QPaintDevice
43 {
44 public:
45 NullPaintDevice(const QSize& size) : m_size(size) { }
46 ~NullPaintDevice() { }
47
48 int metric(PaintDeviceMetric metric) const
49 {
50 switch (metric)
51 {
53 return m_size.width();
55 return m_size.height();
57 return 1;
59 return 1;
61 return int((uint)(-1));
63 return 1;
65 return 1;
67 return 1;
69 return 1;
71 return 1;
73 return 1;
74 }
75 return 1;
76 }
77
78 QPaintEngine* paintEngine() const
79 {
80 static NullPaintEngine nullPaintEngine;
81 return &nullPaintEngine;
82 }
83
84 private:
85 QSize m_size;
86 };
87
88}
89
90#endif
int height() const const
int width() const const
typedef ImageConversionFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:18:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.