1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
3 SPDX-FileCopyrightText: 2007 Olaf Schmidt <ojschmidt@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KGUIADDONS_COLORHELPERS_P_H
9#define KGUIADDONS_COLORHELPERS_P_H
10
11// normalize: like qBound(a, 0.0, 1.0) but without needing the args and with
12// "safer" behavior on NaN (isnan(a) -> return 0.0)
13static inline qreal normalize(qreal a)
14{
15 return (a < 1.0 ? (a > 0.0 ? a : 0.0) : 1.0);
16}
17
18#endif // KGUIADDONS_KCOLORHELPERS_P_H
19

source code of kguiaddons/src/colors/kguiaddons_colorhelpers_p.h