Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qssgexrreader_p.h
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:critical reason:data-parser
4
5
#
ifndef
QSSGEXRREADER_P_H
6
#
define
QSSGEXRREADER_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtCore
/
qbytearray
.
h
>
20
#
include
<
QtCore
/
qbytearrayview
.
h
>
21
#
include
<
QtCore
/
qlist
.
h
>
22
#
include
<
QtCore
/
qrect
.
h
>
23
#
include
<
QtCore
/
qsize
.
h
>
24
#
include
<
QtCore
/
qstring
.
h
>
25
#
include
<
QtCore
/
qxpfunctional
.
h
>
26
27
#
include
<
memory
>
28
29
QT_BEGIN_NAMESPACE
30
31
// Reads single part scanline and tiled OpenEXR images with NONE, RLE, ZIPS,
32
// ZIP or PIZ compression. Tiles have to be grouped by tile row. An infinity
33
// becomes the largest finite value of its source format and a NaN becomes 0.
34
class
QSSGExrReader
35
{
36
public
:
37
enum
class
Compression : quint8 {
38
None = 0,
39
Rle = 1,
40
Zips = 2,
41
Zip = 3,
42
Piz = 4,
43
Pxr24 = 5,
44
B44 = 6,
45
B44A = 7,
46
DwaA = 8,
47
DwaB = 9
48
};
49
50
enum
class
PixelType : quint8 { UInt = 0, Half = 1, Float = 2 };
51
52
enum
class
LevelMode : quint8 { OneLevel = 0, MipMap = 1, RipMap = 2 };
53
54
enum
class
LineOrder : quint8 { IncreasingY = 0, DecreasingY = 1, RandomY = 2 };
55
56
struct
Channel
57
{
58
QByteArray name;
59
PixelType type = PixelType::Half;
60
};
61
62
// A negative source fills that component with constantValue instead.
63
struct
ChannelMap
64
{
65
qint32 source[4] = { -1, -1, -1, -1 };
66
float
constantValue[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
67
};
68
69
// Per quantity bounds, not a budget for the total memory a decode uses.
70
struct
Limits
71
{
72
qint32 maxWidth = 65536;
73
qint32 maxHeight = 65536;
74
qint64 maxPixels = 1 << 28;
75
qint32 maxChannels = 64;
76
qint32 maxAttributes = 1024;
77
qint64 maxAttributeBytes = 1 << 20;
78
qint64 maxChunkBytes = 1 << 28;
79
qint64 maxDecodedBytes = 1 << 30;
80
};
81
82
enum
Flag : quint8 { NoFlags = 0x0, FlipVertically = 0x1 };
83
Q_DECLARE_FLAGS(Flags, Flag)
84
85
QSSGExrReader();
86
~QSSGExrReader();
87
Q_DISABLE_COPY_MOVE(QSSGExrReader)
88
89
// Checks the magic number only.
90
static
bool
isExr(QByteArrayView data);
91
92
void
setLimits(
const
Limits &limits);
93
const
Limits &limits()
const
;
94
95
// Keeps a shallow copy of data for decode().
96
bool
parseHeader(
const
QByteArray &data);
97
98
bool
isValid()
const
;
99
QSize size()
const
;
// of the data window
100
QRect dataWindow()
const
;
101
QRect displayWindow()
const
;
102
Compression compression()
const
;
103
LineOrder lineOrder()
const
;
104
const
QList<Channel> &channels()
const
;
105
qint32 indexOfChannel(QByteArrayView name)
const
;
// -1 when absent
106
107
bool
isTiled()
const
;
108
QSize tileSize()
const
;
// invalid when not tiled
109
LevelMode levelMode()
const
;
110
111
// 'rgba' holds 4 * size().width() floats, valid for the call only. Rows
112
// arrive in an unspecified order, exactly once each, dstRow already
113
// accounting for FlipVertically. The sink may be called from several
114
// threads at once.
115
using
RowSink = qxp::function_ref<
void
(qint32 dstRow,
const
float
*rgba)
const
>;
116
117
// Resolution level 0 only. Success means every row was delivered.
118
bool
decode(
const
ChannelMap &map, Flags flags, RowSink sink);
119
120
// width * height * 4 tightly packed floats.
121
bool
decodeToRgba32F(
const
ChannelMap &map, Flags flags,
float
*dst, qsizetype dstFloatCount);
122
123
QString errorMessage()
const
;
124
125
private
:
126
class
Private;
127
std::unique_ptr<Private> d;
128
};
129
130
Q_DECLARE_OPERATORS_FOR_FLAGS(QSSGExrReader::Flags)
131
132
// R, G, B and A by name, or a single channel as greyscale.
133
QSSGExrReader::ChannelMap
qssgExrRgbaChannelMap
(
const
QSSGExrReader &reader);
134
135
QT_END_NAMESPACE
136
137
#
endif
// QSSGEXRREADER_P_H
qssgExrRgbaChannelMap
QSSGExrReader::ChannelMap qssgExrRgbaChannelMap(const QSSGExrReader &reader)
Definition
qssgexrreader.cpp:1048
qtquick3d
src
texturehelpers
qssgexrreader_p.h
Generated on
for Qt by
1.18.0