1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-27 02:29:23 +01:00

Added ColorExtensions.Invert and made ColorHelper.Invert obsolete

This commit is contained in:
Ell 2021-07-13 22:34:32 +02:00
parent 6aa9ec03d4
commit a52b46dce9
2 changed files with 13 additions and 6 deletions

View file

@ -14,6 +14,7 @@ Improvements
- Improved NinePatch memory performance
- Moved sound-related classes into Sound namespace
- Added customizable overloads for Keybind, Combination and GenericInput ToString methods
- Added ColorExtensions.Invert and made ColorHelper.Invert obsolete
Fixes
- Set default values for InputHandler held and pressed keys to avoid an exception if buttons are held in the very first frame

View file

@ -18,6 +18,15 @@ namespace MLEM.Extensions {
return color * (other.A / 255F);
}
/// <summary>
/// Returns an inverted version of this color.
/// </summary>
/// <param name="color">The color to invert</param>
/// <returns>The inverted color</returns>
public static Color Invert(this Color color) {
return new Color(Math.Abs(255 - color.R), Math.Abs(255 - color.G), Math.Abs(255 - color.B), color.A);
}
}
/// <summary>
@ -25,13 +34,10 @@ namespace MLEM.Extensions {
/// </summary>
public static class ColorHelper {
/// <summary>
/// Returns an inverted version of the color.
/// </summary>
/// <param name="color">The color to invert</param>
/// <returns>The inverted color</returns>
/// <inheritdoc cref="ColorExtensions.Invert"/>
[Obsolete("This method has been moved to ColorExtensions.Invert")]
public static Color Invert(this Color color) {
return new Color(Math.Abs(255 - color.R), Math.Abs(255 - color.G), Math.Abs(255 - color.B), color.A);
return ColorExtensions.Invert(color);
}
/// <summary>