1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QBLITTABLE_P_H |
41 | #define QBLITTABLE_P_H |
42 | |
43 | // |
44 | // W A R N I N G |
45 | // ------------- |
46 | // |
47 | // This file is not part of the Qt API. It exists purely as an |
48 | // implementation detail. This header file may change from version to |
49 | // version without notice, or even be removed. |
50 | // |
51 | // We mean it. |
52 | // |
53 | |
54 | #include <QtGui/private/qtguiglobal_p.h> |
55 | #include <QtCore/qsize.h> |
56 | #include <QtGui/private/qpixmap_blitter_p.h> |
57 | |
58 | |
59 | #ifndef QT_NO_BLITTABLE |
60 | QT_BEGIN_NAMESPACE |
61 | |
62 | class QImage; |
63 | class QBlittablePrivate; |
64 | |
65 | class Q_GUI_EXPORT QBlittable |
66 | { |
67 | Q_DECLARE_PRIVATE(QBlittable) |
68 | public: |
69 | enum Capability { |
70 | |
71 | SolidRectCapability = 0x0001, |
72 | SourcePixmapCapability = 0x0002, |
73 | SourceOverPixmapCapability = 0x0004, |
74 | SourceOverScaledPixmapCapability = 0x0008, |
75 | AlphaFillRectCapability = 0x0010, |
76 | OpacityPixmapCapability = 0x0020, |
77 | DrawScaledCachedGlyphsCapability = 0x0040, |
78 | SubPixelGlyphsCapability = 0x0080, |
79 | ComplexClipCapability = 0x0100, |
80 | |
81 | // Internal ones |
82 | OutlineCapability = 0x0001000 |
83 | }; |
84 | Q_DECLARE_FLAGS (Capabilities, Capability) |
85 | |
86 | QBlittable(const QSize &size, Capabilities caps); |
87 | virtual ~QBlittable(); |
88 | |
89 | Capabilities capabilities() const; |
90 | QSize size() const; |
91 | |
92 | virtual void fillRect(const QRectF &rect, const QColor &color) = 0; |
93 | virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; |
94 | virtual void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) { |
95 | Q_UNUSED(rect); |
96 | Q_UNUSED(color); |
97 | Q_UNUSED(cmode); |
98 | qWarning(msg: "Please implement alphaFillRect function in your platform or remove AlphaFillRectCapability from it" ); |
99 | } |
100 | virtual void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity) { |
101 | Q_UNUSED(rect); |
102 | Q_UNUSED(pixmap); |
103 | Q_UNUSED(subrect); |
104 | Q_UNUSED(cmode); |
105 | Q_UNUSED(opacity); |
106 | qWarning(msg: "Please implement drawPixmapOpacity function in your platform or remove OpacityPixmapCapability from it" ); |
107 | } |
108 | virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) { |
109 | Q_UNUSED(state); |
110 | Q_UNUSED(glyphFormat); |
111 | Q_UNUSED(numGlyphs); |
112 | Q_UNUSED(glyphs); |
113 | Q_UNUSED(positions); |
114 | Q_UNUSED(fontEngine); |
115 | qWarning(msg: "Please implement drawCachedGlyphs function in your platform or remove DrawCachedGlyphsCapability from it" ); |
116 | return true; |
117 | } |
118 | |
119 | |
120 | QImage *lock(); |
121 | void unlock(); |
122 | |
123 | bool isLocked() const; |
124 | |
125 | protected: |
126 | virtual QImage *doLock() = 0; |
127 | virtual void doUnlock() = 0; |
128 | QBlittablePrivate *d_ptr; |
129 | }; |
130 | |
131 | QT_END_NAMESPACE |
132 | #endif //QT_NO_BLITTABLE |
133 | #endif //QBLITTABLE_P_H |
134 | |