diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a912b9..98db3bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Jump to version: ### MLEM Additions - Added StringBuilder overloads to GenericFont +- Added ColorExtensions.Multiply Improvements - Generify GenericFont's string drawing diff --git a/MLEM/Extensions/ColorExtensions.cs b/MLEM/Extensions/ColorExtensions.cs index e14f5b0..5095888 100644 --- a/MLEM/Extensions/ColorExtensions.cs +++ b/MLEM/Extensions/ColorExtensions.cs @@ -3,16 +3,16 @@ using Microsoft.Xna.Framework; namespace MLEM.Extensions { /// - /// A set of extensions for dealing with objects + /// A set of extensions for dealing with objects. /// public static class ColorExtensions { /// - /// Copies the alpha value from another color into this color. + /// Copies the alpha value from another color into this color and returns the result. /// - /// The color - /// The color to copy the alpha from - /// The first color with the second color's alpha value + /// The color. + /// The color to copy the alpha from. + /// The first color with the second color's alpha value. public static Color CopyAlpha(this Color color, Color other) { return color * (other.A / 255F); } @@ -20,16 +20,26 @@ namespace MLEM.Extensions { /// /// Returns an inverted version of this color. /// - /// The color to invert - /// The inverted color + /// The color to invert. + /// The inverted color. public static Color Invert(this Color color) { return new Color(255 - color.R, 255 - color.G, 255 - color.B, color.A); } + /// + /// Multiplies this color with another color and returns the result. + /// + /// The first color. + /// The second color. + /// The two colors multiplied together. + public static Color Multiply(this Color color, Color other) { + return new Color(color.ToVector4() * other.ToVector4()); + } + } /// - /// A set of utility methods for dealing with objects + /// A set of utility methods for dealing with objects. /// public static class ColorHelper { @@ -37,8 +47,8 @@ namespace MLEM.Extensions { /// Parses a hexadecimal number into an rgba color. /// The number should be in the format 0xaarrggbb. /// - /// The number to parse - /// The resulting color + /// The number to parse. + /// The resulting color. public static Color FromHexRgba(int value) { return new Color(value >> 16 & 0xFF, value >> 8 & 0xFF, value >> 0 & 0xFF, value >> 24 & 0xFF); } @@ -47,8 +57,8 @@ namespace MLEM.Extensions { /// Parses a hexadecimal number into an rgb color with 100% alpha. /// The number should be in the format 0xrrggbb. /// - /// The number to parse - /// The resulting color + /// The number to parse. + /// The resulting color. public static Color FromHexRgb(int value) { return new Color(value >> 16 & 0xFF, value >> 8 & 0xFF, value >> 0 & 0xFF); } @@ -57,8 +67,8 @@ namespace MLEM.Extensions { /// Parses a hexadecimal string into a color. /// The string can either be formatted as RRGGBB or AARRGGBB and can optionally start with a #. /// - /// The string to parse - /// The resulting color + /// The string to parse. + /// The resulting color. public static Color FromHexString(string value) { if (value.StartsWith("#")) value = value.Substring(1);