feat: monogame premultiplied color extension method added
This commit is contained in:
parent
9f4d95a57b
commit
37aca44e45
@ -19,6 +19,12 @@ public static class EngineConverterExtensions
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Color ToColor(this ColorRGBA color) => new(color.R, color.G, color.B, color.A);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Color ToPreMultipliedColor(this ColorRGBA color)
|
||||
{
|
||||
float alphaMultiplier = color.A / 255f;
|
||||
return new((byte)(color.R * alphaMultiplier), (byte)(color.G * alphaMultiplier), (byte)(color.B * alphaMultiplier), color.A);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ColorRGBA ToColorRGBA(this Color color) => new(color.R, color.G, color.B, color.A);
|
||||
|
Loading…
x
Reference in New Issue
Block a user