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