mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-15 15:09:29 +00:00
9fe1d3c619
* Refactor HslColor: Improve implementation, documentation, and API - Added explicit memory layout to prepare for particle update. - Restructured fields as private with readonly property accessors. Struct is meant to be immutable, but the CopyTo method makes it mutable, so this is a trade off - Added nullability annotations and explicit argument validations. - Added Deconstruct method to match MonoGame terminology and marked Destruct as obsolete. - Marked the implicit string conversion as obsolete. Users should use the Parse method as it's more explicity as to what's happening. - Restructure the FromRgb method for better readability and future maintenance. * Deprecate ColorExtensions.ToHsl method in favor of HslColor.FromRgb The ColorExtensions.ToHsl and HslColor.FromRgb methods provide the same functionality but with different implementations. HslColor.FromRgb is more accurate and handles edge cases correctly, so it should be preferred. * Mark ColorExtensions.FromHex as obsolete This just calls ColorHelper.FromHex, which is where the call site should be anyway as this isn't an extension method of Color. * Move FromAbgr to ColorHelper. This is not an extension method. Mark other as obsolete. * Add a const value for machine epsilon * Move ToRgb as a static method of HslColor struct - ColorExtensions.ToRgb has been marked obsolete * Mark ColorExtensions.ToRgb as obsolete * Move ToHex from ColorHelper to ColorExtensions and make it an extension method. Marked ColorHelper.ToHex as obsolete * Mark ColorHelper.FromHsl as obsolete * Clean up namespaces * Add FromHex overload that uses ReadOnlySpan<char> which increases performance and reduces memory allocations * Update documentation of FromAbgr since it was moved to ColorHelper * Fix <c> tag in documentation * Per coding guidelines, fields at top of class declaration * Per coding guidelines, prefix static fields with `s_` * Document the FromName method * Adhere to coding guidelines - If statement, even single line, uses brackets - Inline `Color` definition * Documentat ColorHelper class * Remove extra whitespace line * Clean up unused namespaces * Correct test case * Move to root namespace * Rename to HslColorTests * Add tests for ColorExtensions.ToHex * Use facts not theorys * Add tests for ColorHelper.FromHex