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
qvideotransformation_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 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
QVIDEOTRANSFORMATION_P_H
5
#
define
QVIDEOTRANSFORMATION_P_H
6
7
#
include
<
qtvideo
.
h
>
8
#
include
<
optional
>
9
10
//
11
// W A R N I N G
12
// -------------
13
//
14
// This file is not part of the Qt API. It exists purely as an
15
// implementation detail. This header file may change from version to
16
// version without notice, or even be removed.
17
//
18
// We mean it.
19
//
20
21
QT_BEGIN_NAMESPACE
22
23
struct
VideoTransformation
24
{
25
QtVideo::Rotation rotation = QtVideo::Rotation::None;
26
bool
mirroredHorizontallyAfterRotation =
false
;
27
28
void
rotate(QtVideo::Rotation rotation)
29
{
30
if
(rotation != QtVideo::Rotation::None) {
31
int
angle = qToUnderlying(rotation);
32
if
(mirroredHorizontallyAfterRotation && angle % 180 != 0)
33
angle += 180;
34
35
appendRotation(angle);
36
}
37
}
38
39
void
mirrorHorizontally(
bool
mirror =
true
) { mirroredHorizontallyAfterRotation ^= mirror; }
40
41
void
mirrorVertically(
bool
mirror =
true
)
42
{
43
if
(mirror) {
44
mirroredHorizontallyAfterRotation ^=
true
;
45
appendRotation(180);
46
}
47
}
48
49
int
rotationIndex()
const
{
return
qToUnderlying(rotation) / 90; }
50
51
private
:
52
void
appendRotation(quint32 angle)
53
{
54
rotation = QtVideo::Rotation((angle + qToUnderlying(rotation)) % 360);
55
}
56
};
57
58
using
VideoTransformationOpt
=
std
::optional<VideoTransformation>;
59
60
inline
bool
operator
==(
const
VideoTransformation &lhs,
const
VideoTransformation &rhs)
61
{
62
return
lhs.rotation == rhs.rotation
63
&& lhs.mirroredHorizontallyAfterRotation == rhs.mirroredHorizontallyAfterRotation;
64
}
65
66
inline
bool
operator
!=(
const
VideoTransformation &lhs,
const
VideoTransformation &rhs)
67
{
68
return
!(lhs
==
rhs);
69
}
70
71
Q_MULTIMEDIA_EXPORT
QDebug
operator<<(QDebug dbg,
const
VideoTransformation &transform);
72
73
QT_END_NAMESPACE
74
75
#
endif
// QVIDEOTRANSFORMATION_P_H
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
operator<<
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition
qdir.cpp:2620
operator==
bool operator==(const VideoTransformation &lhs, const VideoTransformation &rhs)
Definition
qvideotransformation_p.h:60
operator!=
bool operator!=(const VideoTransformation &lhs, const VideoTransformation &rhs)
Definition
qvideotransformation_p.h:66
VideoTransformationOpt
std::optional< VideoTransformation > VideoTransformationOpt
Definition
qvideotransformation_p.h:58
qtmultimedia
src
multimedia
qvideotransformation_p.h
Generated on
for Qt by
1.18.0