1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBLITTABLE_P_H
5#define QBLITTABLE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtCore/qsize.h>
20#include <QtGui/private/qpixmap_blitter_p.h>
21
22
23#ifndef QT_NO_BLITTABLE
24QT_BEGIN_NAMESPACE
25
26class QImage;
27class QBlittablePrivate;
28
29class Q_GUI_EXPORT QBlittable
30{
31 Q_DECLARE_PRIVATE(QBlittable)
32public:
33 enum Capability {
34
35 SolidRectCapability = 0x0001,
36 SourcePixmapCapability = 0x0002,
37 SourceOverPixmapCapability = 0x0004,
38 SourceOverScaledPixmapCapability = 0x0008,
39 AlphaFillRectCapability = 0x0010,
40 OpacityPixmapCapability = 0x0020,
41 DrawScaledCachedGlyphsCapability = 0x0040,
42 SubPixelGlyphsCapability = 0x0080,
43 ComplexClipCapability = 0x0100,
44
45 // Internal ones
46 OutlineCapability = 0x0001000
47 };
48 Q_DECLARE_FLAGS (Capabilities, Capability)
49
50 QBlittable(const QSize &size, Capabilities caps);
51 virtual ~QBlittable();
52
53 Capabilities capabilities() const;
54 QSize size() const;
55
56 virtual void fillRect(const QRectF &rect, const QColor &color) = 0;
57 virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0;
58 virtual void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) {
59 Q_UNUSED(rect);
60 Q_UNUSED(color);
61 Q_UNUSED(cmode);
62 qWarning(msg: "Please implement alphaFillRect function in your platform or remove AlphaFillRectCapability from it");
63 }
64 virtual void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity) {
65 Q_UNUSED(rect);
66 Q_UNUSED(pixmap);
67 Q_UNUSED(subrect);
68 Q_UNUSED(cmode);
69 Q_UNUSED(opacity);
70 qWarning(msg: "Please implement drawPixmapOpacity function in your platform or remove OpacityPixmapCapability from it");
71 }
72 virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) {
73 Q_UNUSED(state);
74 Q_UNUSED(glyphFormat);
75 Q_UNUSED(numGlyphs);
76 Q_UNUSED(glyphs);
77 Q_UNUSED(positions);
78 Q_UNUSED(fontEngine);
79 qWarning(msg: "Please implement drawCachedGlyphs function in your platform or remove DrawCachedGlyphsCapability from it");
80 return true;
81 }
82
83
84 QImage *lock();
85 void unlock();
86
87 bool isLocked() const;
88
89protected:
90 virtual QImage *doLock() = 0;
91 virtual void doUnlock() = 0;
92 QBlittablePrivate *d_ptr;
93};
94
95QT_END_NAMESPACE
96#endif //QT_NO_BLITTABLE
97#endif //QBLITTABLE_P_H
98

source code of qtbase/src/gui/painting/qblittable_p.h