From 2c7d2893c8e555eff2292d69dff10dabf9e168e3 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Wed, 26 Oct 2022 14:58:55 +0200 Subject: [PATCH] Add `Color.FromRGBA` --- Source/Engine/Core/Math/Color.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Engine/Core/Math/Color.h b/Source/Engine/Core/Math/Color.h index de79f5b6a..f011709cd 100644 --- a/Source/Engine/Core/Math/Color.h +++ b/Source/Engine/Core/Math/Color.h @@ -138,6 +138,16 @@ public: return Color(static_cast(rgb >> 16 & 0xff) / 255.0f, static_cast(rgb >> 8 & 0xff) / 255.0f, static_cast(rgb & 0xff) / 255.0f, a); } + /// + /// Initializes from packed RGBA value. + /// + /// The packed RGBA value. + /// The color. + static Color FromRGBA(uint32 rgba) + { + return Color(static_cast(rgba >> 16 & 0xff) / 255.0f, static_cast(rgba >> 8 & 0xff) / 255.0f, static_cast(rgba & 0xff) / 255.0f, static_cast(rgba >> 24 & 0xff) / 255.0f); + } + static Color FromHex(const String& hexString) { bool isValid;