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
qquickcolordialogutils.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 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
// Qt-Security score:significant reason:default
4
5
#
include
"qquickcolordialogutils_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
std::pair<qreal, qreal> getSaturationAndValue(qreal saturation, qreal lightness)
10
{
11
const
qreal v = lightness + saturation * qMin(lightness, 1 - lightness);
12
if
(v == .0)
13
return
{ .0, .0 };
14
const
qreal s = 2 * (1 - lightness / v);
15
return
{ s, v };
16
}
17
18
std
::
pair
<
qreal
,
qreal
>
getSaturationAndLightness
(qreal saturation, qreal value)
19
{
20
const
qreal l = value * (1 - saturation / 2);
21
if
(l == .0)
22
return
{ .0, .0 };
23
if
(l == 1 && value == 1)
24
return
{ saturation, l };
25
const
qreal s = (value - l) / qMin(l, 1 - l);
26
return
{ s, l };
27
}
28
29
QT_END_NAMESPACE
QPlatformGraphicsBufferHelper
\inmodule QtGui
getSaturationAndLightness
std::pair< qreal, qreal > getSaturationAndLightness(qreal saturation, qreal value)
Definition
qquickcolordialogutils.cpp:18
qtdeclarative
src
quickdialogs
quickdialogsquickimpl
qquickcolordialogutils.cpp
Generated on
for Qt by
1.14.0