Basically, why the need for two abstractions of a pretty simple concept?
System.Windows.Media.Color
is part of the System.Windows.Media
namespace:
Provides types that enable integration of rich media, including drawings, text, and audio/video content in Windows Presentation Foundation (WPF) applications.
System.Drawing.Color
is part of the System.Drawing
namespace:
The System.Drawing namespace provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces.
I'm guessing that the latter is Windows specific, whilst the former is more general and is more easily portable to Mac OS etc. for use in Silverlight applications.
There is also this caution on the latter namespace which would tend to support this:
Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.
I don't think there was a "need" as such, just that they made an early (probably wrong) decision to put the Color class into the the WinForms-specific System.Drawing - because at the time, Win32 and Winforms was all there was.
Later when they wanted to enhance the concepts in "Color", they didn't want WPF to depend on WinForms. So rather than fix the situation by moving a more abstract Color class to a generic assembly, they just copy-pasted a new Color class in WPF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With