Add explicit operator for Color32 to Int4

This commit is contained in:
Wojtek Figat
2021-10-25 23:23:33 +02:00
parent 07a6e50d14
commit cc7959a390

View File

@@ -244,13 +244,21 @@ namespace FlaxEngine
return new Color(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);
}
/// <summary>
/// Performs an explicit conversion from <see cref="Color32" /> to <see cref="Int4" />.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns>
public static explicit operator Int4(Color32 value)
{
return new Int4(value.R, value.G, value.B, value.A);
}
/// <summary>
/// Performs an explicit conversion from <see cref="Color32"/> to <see cref="Vector4"/>.
/// </summary>
/// <param name="c">The color.</param>
/// <returns>
/// The result of the conversion.
/// </returns>
/// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Color32 c)
{
return new Vector4(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);