diff options
Diffstat (limited to 'xbmc/utils/ColorUtils.cpp')
| -rw-r--r-- | xbmc/utils/ColorUtils.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xbmc/utils/ColorUtils.cpp b/xbmc/utils/ColorUtils.cpp new file mode 100644 index 0000000..80319a0 --- /dev/null +++ b/xbmc/utils/ColorUtils.cpp | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include "ColorUtils.h" | ||
| 10 | |||
| 11 | #include "Color.h" | ||
| 12 | |||
| 13 | #include <math.h> | ||
| 14 | |||
| 15 | UTILS::Color ColorUtils::ChangeOpacity(const UTILS::Color color, const float opacity) | ||
| 16 | { | ||
| 17 | int newAlpha = ceil( ((color >> 24) & 0xff) * opacity); | ||
| 18 | return (color & 0x00FFFFFF) | (newAlpha << 24); | ||
| 19 | }; | ||
