Add Color.FromRGBA

This commit is contained in:
Wojtek Figat
2022-04-15 19:16:30 +02:00
parent 75b61f2bef
commit ddb9b327d4

View File

@@ -230,6 +230,20 @@ namespace FlaxEngine
a);
}
/// <summary>
/// Creates <see cref="Color"/> from the RGBA value.
/// </summary>
/// <param name="rgb">The packed RGBA value.</param>
/// <returns>The color.</returns>
public static Color FromRGBA(uint rgb)
{
return new Color(
((rgb >> 16) & 0xff) / 255.0f,
((rgb >> 8) & 0xff) / 255.0f,
(rgb & 0xff) / 255.0f,
((rgb >> 24) & 0xff) / 255.0f);
}
/// <summary>
/// Gets the color value as the hexadecimal string.
/// </summary>