From cc7959a3906c09f42318bd8d9a8b85f9689ff2f3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 25 Oct 2021 23:23:33 +0200 Subject: [PATCH] Add explicit operator for Color32 to Int4 --- Source/Engine/Core/Math/Color32.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Engine/Core/Math/Color32.cs b/Source/Engine/Core/Math/Color32.cs index c8421715c..88d0b9fd2 100644 --- a/Source/Engine/Core/Math/Color32.cs +++ b/Source/Engine/Core/Math/Color32.cs @@ -244,13 +244,21 @@ namespace FlaxEngine return new Color(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); } + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Int4(Color32 value) + { + return new Int4(value.R, value.G, value.B, value.A); + } + /// /// Performs an explicit conversion from to . /// /// The color. - /// - /// The result of the conversion. - /// + /// The result of the conversion. public static explicit operator Vector4(Color32 c) { return new Vector4(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);