Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenglpixeltransferoptions.cpp
Go to the documentation of this file.
1
// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qopenglpixeltransferoptions.h"
6
#
include
<
QSharedData
>
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
* \class QOpenGLPixelTransferOptions
12
* \inmodule QtOpenGL
13
*
14
* \brief The QOpenGLPixelTransferOptions class describes the pixel storage
15
* modes that affect the unpacking of pixels during texture upload.
16
*/
17
18
/*!
19
* \fn QOpenGLPixelTransferOptions & QOpenGLPixelTransferOptions::operator=(QOpenGLPixelTransferOptions &&other)
20
* \internal
21
*/
22
23
/*!
24
* \fn void QOpenGLPixelTransferOptions::swap(QOpenGLPixelTransferOptions &other)
25
* \memberswap{options}
26
*/
27
28
class
QOpenGLPixelTransferOptionsData :
public
QSharedData
29
{
30
public
:
31
QOpenGLPixelTransferOptionsData()
32
: alignment(4)
33
, skipImages(0)
34
, skipRows(0)
35
, skipPixels(0)
36
, imageHeight(0)
37
, rowLength(0)
38
, lsbFirst(
false
)
39
, swapBytes(
false
)
40
{}
41
42
int
alignment;
43
int
skipImages;
44
int
skipRows;
45
int
skipPixels;
46
int
imageHeight;
47
int
rowLength;
48
bool
lsbFirst;
49
bool
swapBytes;
50
};
51
52
/*!
53
* Constructs a new QOpenGLPixelTransferOptions instance with the default settings.
54
*/
55
QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions()
56
: data(
new
QOpenGLPixelTransferOptionsData)
57
{
58
}
59
60
/*!
61
* \internal
62
*/
63
QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions(
const
QOpenGLPixelTransferOptions &rhs)
64
: data(rhs.data)
65
{
66
}
67
68
/*!
69
* \internal
70
*/
71
QOpenGLPixelTransferOptions &QOpenGLPixelTransferOptions::operator=(
const
QOpenGLPixelTransferOptions &rhs)
72
{
73
if
(
this
!= &rhs)
74
data.operator=(rhs.data);
75
return
*
this
;
76
}
77
78
/*!
79
* Destructor.
80
*/
81
QOpenGLPixelTransferOptions::~QOpenGLPixelTransferOptions()
82
{
83
}
84
85
/*!
86
* Sets the \a alignment requirements for each pixel row. Corresponds to \c GL_UNPACK_ALIGNMENT.
87
* The default value is 4, as specified by OpenGL.
88
*/
89
void
QOpenGLPixelTransferOptions::setAlignment(
int
alignment)
90
{
91
data->alignment = alignment;
92
}
93
94
/*!
95
* \return the current alignment requirement for each pixel row.
96
*/
97
int
QOpenGLPixelTransferOptions::alignment()
const
98
{
99
return
data->alignment;
100
}
101
102
/*!
103
* Sets the number of images that are skipped to \a skipImages.
104
* Corresponds to \c GL_UNPACK_SKIP_IMAGES. Equivalent to incrementing the pointer
105
* passed to QOpenGLTexture::setData(). The default value is 0.
106
*/
107
void
QOpenGLPixelTransferOptions::setSkipImages(
int
skipImages)
108
{
109
data->skipImages = skipImages;
110
}
111
112
/*!
113
* \return the number of images that are skipped.
114
*/
115
int
QOpenGLPixelTransferOptions::skipImages()
const
116
{
117
return
data->skipImages;
118
}
119
120
/*!
121
* Sets the number of rows that are skipped to \a skipRows.
122
* Corresponds to \c GL_UNPACK_SKIP_ROWS. Equivalent to incrementing the pointer
123
* passed to QOpenGLTexture::setData(). The default value is 0.
124
*/
125
void
QOpenGLPixelTransferOptions::setSkipRows(
int
skipRows)
126
{
127
data->skipRows = skipRows;
128
}
129
130
/*!
131
* \return the number of rows that are skipped.
132
*/
133
int
QOpenGLPixelTransferOptions::skipRows()
const
134
{
135
return
data->skipRows;
136
}
137
138
/*!
139
* Sets the number of pixels that are skipped to \a skipPixels.
140
* Corresponds to \c GL_UNPACK_SKIP_PIXELS. Equivalent to incrementing the pointer
141
* passed to QOpenGLTexture::setData(). The default value is 0.
142
*/
143
void
QOpenGLPixelTransferOptions::setSkipPixels(
int
skipPixels)
144
{
145
data->skipPixels = skipPixels;
146
}
147
148
/*!
149
* \return the number of pixels that are skipped.
150
*/
151
int
QOpenGLPixelTransferOptions::skipPixels()
const
152
{
153
return
data->skipPixels;
154
}
155
156
/*!
157
* Sets the image height for 3D textures to \a imageHeight.
158
* Corresponds to \c GL_UNPACK_IMAGE_HEIGHT.
159
* The default value is 0.
160
*/
161
void
QOpenGLPixelTransferOptions::setImageHeight(
int
imageHeight)
162
{
163
data->imageHeight = imageHeight;
164
}
165
166
/*!
167
* \return the currently set image height.
168
*/
169
int
QOpenGLPixelTransferOptions::imageHeight()
const
170
{
171
return
data->imageHeight;
172
}
173
174
/*!
175
* Sets the number of pixels in a row to \a rowLength.
176
* Corresponds to \c GL_UNPACK_ROW_LENGTH.
177
* The default value is 0.
178
*/
179
void
QOpenGLPixelTransferOptions::setRowLength(
int
rowLength)
180
{
181
data->rowLength = rowLength;
182
}
183
184
/*!
185
* \return the currently set row length.
186
*/
187
int
QOpenGLPixelTransferOptions::rowLength()
const
188
{
189
return
data->rowLength;
190
}
191
192
/*!
193
* \a lsbFirst specifies if bits within a byte are ordered from least to most significat.
194
* The default value is \c false, meaning that the first bit in each byte is the
195
* most significant one. This is significant for bitmap data only.
196
* Corresponds to \c GL_UNPACK_LSB_FIRST.
197
*/
198
void
QOpenGLPixelTransferOptions::setLeastSignificantByteFirst(
bool
lsbFirst)
199
{
200
data->lsbFirst = lsbFirst;
201
}
202
203
/*!
204
* \return \c true if bits within a byte are ordered from least to most significant.
205
*/
206
bool
QOpenGLPixelTransferOptions::isLeastSignificantBitFirst()
const
207
{
208
return
data->lsbFirst;
209
}
210
211
/*!
212
* \a swapBytes specifies if the byte ordering for multibyte components is reversed.
213
* The default value is \c false.
214
* Corresponds to \c GL_UNPACK_SWAP_BYTES.
215
*/
216
void
QOpenGLPixelTransferOptions::setSwapBytesEnabled(
bool
swapBytes)
217
{
218
data->swapBytes = swapBytes;
219
}
220
221
/*!
222
* \return \c true if the byte ordering for multibyte components is reversed.
223
*/
224
bool
QOpenGLPixelTransferOptions::isSwapBytesEnabled()
const
225
{
226
return
data->swapBytes;
227
}
228
229
QT_END_NAMESPACE
qtbase
src
opengl
qopenglpixeltransferoptions.cpp
Generated on
for Qt by
1.16.1