1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-29 15:58:33 +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 - Improved NinePatch memory performance
- Moved sound-related classes into Sound namespace - Moved sound-related classes into Sound namespace
- Added customizable overloads for Keybind, Combination and GenericInput ToString methods - Added customizable overloads for Keybind, Combination and GenericInput ToString methods
- Added ColorExtensions.Invert and made ColorHelper.Invert obsolete
Fixes Fixes
- Set default values for InputHandler held and pressed keys to avoid an exception if buttons are held in the very first frame - 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); 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> /// <summary>
@ -25,13 +34,10 @@ namespace MLEM.Extensions {
/// </summary> /// </summary>
public static class ColorHelper { public static class ColorHelper {
/// <summary> /// <inheritdoc cref="ColorExtensions.Invert"/>
/// Returns an inverted version of the color. [Obsolete("This method has been moved to ColorExtensions.Invert")]
/// </summary>
/// <param name="color">The color to invert</param>
/// <returns>The inverted color</returns>
public static Color Invert(this Color color) { 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> /// <summary>