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 QPICTURE_P_H
41#define QPICTURE_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/qatomic.h"
56#include "QtCore/qbuffer.h"
57#include "QtCore/qlist.h"
58#include "QtCore/qobjectdefs.h"
59#include "QtCore/qrect.h"
60#include "QtGui/qpicture.h"
61#include "QtGui/qpixmap.h"
62#include "QtGui/qpen.h"
63#include "QtGui/qbrush.h"
64#include "private/qobject_p.h"
65
66QT_BEGIN_NAMESPACE
67
68class QPaintEngine;
69
70extern const char *qt_mfhdr_tag;
71
72class QPicturePrivate
73{
74 friend class QPicturePaintEngine;
75 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QPicture &r);
76 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &s, QPicture &r);
77
78public:
79 enum PaintCommand {
80 PdcNOP = 0, // <void>
81 PdcDrawPoint = 1, // point
82 PdcDrawFirst = PdcDrawPoint,
83 PdcMoveTo = 2, // point
84 PdcLineTo = 3, // point
85 PdcDrawLine = 4, // point,point
86 PdcDrawRect = 5, // rect
87 PdcDrawRoundRect = 6, // rect,ival,ival
88 PdcDrawEllipse = 7, // rect
89 PdcDrawArc = 8, // rect,ival,ival
90 PdcDrawPie = 9, // rect,ival,ival
91 PdcDrawChord = 10, // rect,ival,ival
92 PdcDrawLineSegments = 11, // ptarr
93 PdcDrawPolyline = 12, // ptarr
94 PdcDrawPolygon = 13, // ptarr,ival
95 PdcDrawCubicBezier = 14, // ptarr
96 PdcDrawText = 15, // point,str
97 PdcDrawTextFormatted = 16, // rect,ival,str
98 PdcDrawPixmap = 17, // rect,pixmap
99 PdcDrawImage = 18, // rect,image
100 PdcDrawText2 = 19, // point,str
101 PdcDrawText2Formatted = 20, // rect,ival,str
102 PdcDrawTextItem = 21, // pos,text,font,flags
103 PdcDrawLast = PdcDrawTextItem,
104 PdcDrawPoints = 22, // ptarr,ival,ival
105 PdcDrawWinFocusRect = 23, // rect,color
106 PdcDrawTiledPixmap = 24, // rect,pixmap,point
107 PdcDrawPath = 25, // path
108
109 // no painting commands below PdcDrawLast.
110
111 PdcBegin = 30, // <void>
112 PdcEnd = 31, // <void>
113 PdcSave = 32, // <void>
114 PdcRestore = 33, // <void>
115 PdcSetdev = 34, // device - PRIVATE
116 PdcSetBkColor = 40, // color
117 PdcSetBkMode = 41, // ival
118 PdcSetROP = 42, // ival
119 PdcSetBrushOrigin = 43, // point
120 PdcSetFont = 45, // font
121 PdcSetPen = 46, // pen
122 PdcSetBrush = 47, // brush
123 PdcSetTabStops = 48, // ival
124 PdcSetTabArray = 49, // ival,ivec
125 PdcSetUnit = 50, // ival
126 PdcSetVXform = 51, // ival
127 PdcSetWindow = 52, // rect
128 PdcSetViewport = 53, // rect
129 PdcSetWXform = 54, // ival
130 PdcSetWMatrix = 55, // matrix,ival
131 PdcSaveWMatrix = 56,
132 PdcRestoreWMatrix = 57,
133 PdcSetClip = 60, // ival
134 PdcSetClipRegion = 61, // rgn
135 PdcSetClipPath = 62, // path
136 PdcSetRenderHint = 63, // ival
137 PdcSetCompositionMode = 64, // ival
138 PdcSetClipEnabled = 65, // bool
139 PdcSetOpacity = 66, // qreal
140
141 PdcReservedStart = 0, // codes 0-199 are reserved
142 PdcReservedStop = 199 // for Qt
143 };
144
145 QPicturePrivate();
146 QPicturePrivate(const QPicturePrivate &other);
147 QAtomicInt ref;
148
149 bool checkFormat();
150 void resetFormat();
151
152 QBuffer pictb;
153 int trecs;
154 bool formatOk;
155 int formatMajor;
156 int formatMinor;
157 QRect brect;
158 QRect override_rect;
159 QScopedPointer<QPaintEngine> paintEngine;
160 bool in_memory_only;
161 QList<QImage> image_list;
162 QList<QPixmap> pixmap_list;
163 QList<QBrush> brush_list;
164 QList<QPen> pen_list;
165};
166
167QT_END_NAMESPACE
168
169#endif // QPICTURE_P_H
170