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

source code of qtbase/src/gui/image/qpicture_p.h