Browse Source

Merge pull request #920 from AvaloniaUI/immutable-brushes

Added a set of immutable brushes.
Steven Kirk 8 years ago
parent
commit
a887e4a73d

+ 0 - 1
src/Avalonia.Themes.Default/Accents/BaseLight.xaml

@@ -1,6 +1,5 @@
 <Style xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-       xmlns:mut="https://github.com/avaloniaui/mutable"
        xmlns:sys="clr-namespace:System;assembly=mscorlib">
   <Style.Resources>
     <SolidColorBrush x:Key="ThemeBackgroundBrush">#FFFFFFFF</SolidColorBrush>

+ 2 - 1
src/Avalonia.Visuals/Media/Brush.cs

@@ -46,7 +46,8 @@ namespace Avalonia.Media
 
                 if (member != null)
                 {
-                    return (IBrush)member.GetValue(null);
+                    var brush = (ISolidColorBrush)member.GetValue(null);
+                    return new SolidColorBrush(brush.Color, brush.Opacity);
                 }
                 else
                 {

+ 284 - 282
src/Avalonia.Visuals/Media/Brushes.cs

@@ -1,6 +1,8 @@
 // Copyright (c) The Avalonia Project. All rights reserved.
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
+using Avalonia.Media.Immutable;
+
 namespace Avalonia.Media
 {
     /// <summary>
@@ -13,852 +15,852 @@ namespace Avalonia.Media
         /// </summary>
         static Brushes()
         {
-            AliceBlue = new SolidColorBrush(Colors.AliceBlue);
-            AntiqueWhite = new SolidColorBrush(Colors.AntiqueWhite);
-            Aqua = new SolidColorBrush(Colors.Aqua);
-            Aquamarine = new SolidColorBrush(Colors.Aquamarine);
-            Azure = new SolidColorBrush(Colors.Azure);
-            Beige = new SolidColorBrush(Colors.Beige);
-            Bisque = new SolidColorBrush(Colors.Bisque);
-            Black = new SolidColorBrush(Colors.Black);
-            BlanchedAlmond = new SolidColorBrush(Colors.BlanchedAlmond);
-            Blue = new SolidColorBrush(Colors.Blue);
-            BlueViolet = new SolidColorBrush(Colors.BlueViolet);
-            Brown = new SolidColorBrush(Colors.Brown);
-            BurlyWood = new SolidColorBrush(Colors.BurlyWood);
-            CadetBlue = new SolidColorBrush(Colors.CadetBlue);
-            Chartreuse = new SolidColorBrush(Colors.Chartreuse);
-            Chocolate = new SolidColorBrush(Colors.Chocolate);
-            Coral = new SolidColorBrush(Colors.Coral);
-            CornflowerBlue = new SolidColorBrush(Colors.CornflowerBlue);
-            Cornsilk = new SolidColorBrush(Colors.Cornsilk);
-            Crimson = new SolidColorBrush(Colors.Crimson);
-            Cyan = new SolidColorBrush(Colors.Cyan);
-            DarkBlue = new SolidColorBrush(Colors.DarkBlue);
-            DarkCyan = new SolidColorBrush(Colors.DarkCyan);
-            DarkGoldenrod = new SolidColorBrush(Colors.DarkGoldenrod);
-            DarkGray = new SolidColorBrush(Colors.DarkGray);
-            DarkGreen = new SolidColorBrush(Colors.DarkGreen);
-            DarkKhaki = new SolidColorBrush(Colors.DarkKhaki);
-            DarkMagenta = new SolidColorBrush(Colors.DarkMagenta);
-            DarkOliveGreen = new SolidColorBrush(Colors.DarkOliveGreen);
-            DarkOrange = new SolidColorBrush(Colors.DarkOrange);
-            DarkOrchid = new SolidColorBrush(Colors.DarkOrchid);
-            DarkRed = new SolidColorBrush(Colors.DarkRed);
-            DarkSalmon = new SolidColorBrush(Colors.DarkSalmon);
-            DarkSeaGreen = new SolidColorBrush(Colors.DarkSeaGreen);
-            DarkSlateBlue = new SolidColorBrush(Colors.DarkSlateBlue);
-            DarkSlateGray = new SolidColorBrush(Colors.DarkSlateGray);
-            DarkTurquoise = new SolidColorBrush(Colors.DarkTurquoise);
-            DarkViolet = new SolidColorBrush(Colors.DarkViolet);
-            DeepPink = new SolidColorBrush(Colors.DeepPink);
-            DeepSkyBlue = new SolidColorBrush(Colors.DeepSkyBlue);
-            DimGray = new SolidColorBrush(Colors.DimGray);
-            DodgerBlue = new SolidColorBrush(Colors.DodgerBlue);
-            Firebrick = new SolidColorBrush(Colors.Firebrick);
-            FloralWhite = new SolidColorBrush(Colors.FloralWhite);
-            ForestGreen = new SolidColorBrush(Colors.ForestGreen);
-            Fuchsia = new SolidColorBrush(Colors.Fuchsia);
-            Gainsboro = new SolidColorBrush(Colors.Gainsboro);
-            GhostWhite = new SolidColorBrush(Colors.GhostWhite);
-            Gold = new SolidColorBrush(Colors.Gold);
-            Goldenrod = new SolidColorBrush(Colors.Goldenrod);
-            Gray = new SolidColorBrush(Colors.Gray);
-            Green = new SolidColorBrush(Colors.Green);
-            GreenYellow = new SolidColorBrush(Colors.GreenYellow);
-            Honeydew = new SolidColorBrush(Colors.Honeydew);
-            HotPink = new SolidColorBrush(Colors.HotPink);
-            IndianRed = new SolidColorBrush(Colors.IndianRed);
-            Indigo = new SolidColorBrush(Colors.Indigo);
-            Ivory = new SolidColorBrush(Colors.Ivory);
-            Khaki = new SolidColorBrush(Colors.Khaki);
-            Lavender = new SolidColorBrush(Colors.Lavender);
-            LavenderBlush = new SolidColorBrush(Colors.LavenderBlush);
-            LawnGreen = new SolidColorBrush(Colors.LawnGreen);
-            LemonChiffon = new SolidColorBrush(Colors.LemonChiffon);
-            LightBlue = new SolidColorBrush(Colors.LightBlue);
-            LightCoral = new SolidColorBrush(Colors.LightCoral);
-            LightCyan = new SolidColorBrush(Colors.LightCyan);
-            LightGoldenrodYellow = new SolidColorBrush(Colors.LightGoldenrodYellow);
-            LightGray = new SolidColorBrush(Colors.LightGray);
-            LightGreen = new SolidColorBrush(Colors.LightGreen);
-            LightPink = new SolidColorBrush(Colors.LightPink);
-            LightSalmon = new SolidColorBrush(Colors.LightSalmon);
-            LightSeaGreen = new SolidColorBrush(Colors.LightSeaGreen);
-            LightSkyBlue = new SolidColorBrush(Colors.LightSkyBlue);
-            LightSlateGray = new SolidColorBrush(Colors.LightSlateGray);
-            LightSteelBlue = new SolidColorBrush(Colors.LightSteelBlue);
-            LightYellow = new SolidColorBrush(Colors.LightYellow);
-            Lime = new SolidColorBrush(Colors.Lime);
-            LimeGreen = new SolidColorBrush(Colors.LimeGreen);
-            Linen = new SolidColorBrush(Colors.Linen);
-            Magenta = new SolidColorBrush(Colors.Magenta);
-            Maroon = new SolidColorBrush(Colors.Maroon);
-            MediumAquamarine = new SolidColorBrush(Colors.MediumAquamarine);
-            MediumBlue = new SolidColorBrush(Colors.MediumBlue);
-            MediumOrchid = new SolidColorBrush(Colors.MediumOrchid);
-            MediumPurple = new SolidColorBrush(Colors.MediumPurple);
-            MediumSeaGreen = new SolidColorBrush(Colors.MediumSeaGreen);
-            MediumSlateBlue = new SolidColorBrush(Colors.MediumSlateBlue);
-            MediumSpringGreen = new SolidColorBrush(Colors.MediumSpringGreen);
-            MediumTurquoise = new SolidColorBrush(Colors.MediumTurquoise);
-            MediumVioletRed = new SolidColorBrush(Colors.MediumVioletRed);
-            MidnightBlue = new SolidColorBrush(Colors.MidnightBlue);
-            MintCream = new SolidColorBrush(Colors.MintCream);
-            MistyRose = new SolidColorBrush(Colors.MistyRose);
-            Moccasin = new SolidColorBrush(Colors.Moccasin);
-            NavajoWhite = new SolidColorBrush(Colors.NavajoWhite);
-            Navy = new SolidColorBrush(Colors.Navy);
-            OldLace = new SolidColorBrush(Colors.OldLace);
-            Olive = new SolidColorBrush(Colors.Olive);
-            OliveDrab = new SolidColorBrush(Colors.OliveDrab);
-            Orange = new SolidColorBrush(Colors.Orange);
-            OrangeRed = new SolidColorBrush(Colors.OrangeRed);
-            Orchid = new SolidColorBrush(Colors.Orchid);
-            PaleGoldenrod = new SolidColorBrush(Colors.PaleGoldenrod);
-            PaleGreen = new SolidColorBrush(Colors.PaleGreen);
-            PaleTurquoise = new SolidColorBrush(Colors.PaleTurquoise);
-            PaleVioletRed = new SolidColorBrush(Colors.PaleVioletRed);
-            PapayaWhip = new SolidColorBrush(Colors.PapayaWhip);
-            PeachPuff = new SolidColorBrush(Colors.PeachPuff);
-            Peru = new SolidColorBrush(Colors.Peru);
-            Pink = new SolidColorBrush(Colors.Pink);
-            Plum = new SolidColorBrush(Colors.Plum);
-            PowderBlue = new SolidColorBrush(Colors.PowderBlue);
-            Purple = new SolidColorBrush(Colors.Purple);
-            Red = new SolidColorBrush(Colors.Red);
-            RosyBrown = new SolidColorBrush(Colors.RosyBrown);
-            RoyalBlue = new SolidColorBrush(Colors.RoyalBlue);
-            SaddleBrown = new SolidColorBrush(Colors.SaddleBrown);
-            Salmon = new SolidColorBrush(Colors.Salmon);
-            SandyBrown = new SolidColorBrush(Colors.SandyBrown);
-            SeaGreen = new SolidColorBrush(Colors.SeaGreen);
-            SeaShell = new SolidColorBrush(Colors.SeaShell);
-            Sienna = new SolidColorBrush(Colors.Sienna);
-            Silver = new SolidColorBrush(Colors.Silver);
-            SkyBlue = new SolidColorBrush(Colors.SkyBlue);
-            SlateBlue = new SolidColorBrush(Colors.SlateBlue);
-            SlateGray = new SolidColorBrush(Colors.SlateGray);
-            Snow = new SolidColorBrush(Colors.Snow);
-            SpringGreen = new SolidColorBrush(Colors.SpringGreen);
-            SteelBlue = new SolidColorBrush(Colors.SteelBlue);
-            Tan = new SolidColorBrush(Colors.Tan);
-            Teal = new SolidColorBrush(Colors.Teal);
-            Thistle = new SolidColorBrush(Colors.Thistle);
-            Tomato = new SolidColorBrush(Colors.Tomato);
-            Transparent = new SolidColorBrush(Colors.Transparent);
-            Turquoise = new SolidColorBrush(Colors.Turquoise);
-            Violet = new SolidColorBrush(Colors.Violet);
-            Wheat = new SolidColorBrush(Colors.Wheat);
-            White = new SolidColorBrush(Colors.White);
-            WhiteSmoke = new SolidColorBrush(Colors.WhiteSmoke);
-            Yellow = new SolidColorBrush(Colors.Yellow);
-            YellowGreen = new SolidColorBrush(Colors.YellowGreen);
+            AliceBlue = new ImmutableSolidColorBrush(Colors.AliceBlue);
+            AntiqueWhite = new ImmutableSolidColorBrush(Colors.AntiqueWhite);
+            Aqua = new ImmutableSolidColorBrush(Colors.Aqua);
+            Aquamarine = new ImmutableSolidColorBrush(Colors.Aquamarine);
+            Azure = new ImmutableSolidColorBrush(Colors.Azure);
+            Beige = new ImmutableSolidColorBrush(Colors.Beige);
+            Bisque = new ImmutableSolidColorBrush(Colors.Bisque);
+            Black = new ImmutableSolidColorBrush(Colors.Black);
+            BlanchedAlmond = new ImmutableSolidColorBrush(Colors.BlanchedAlmond);
+            Blue = new ImmutableSolidColorBrush(Colors.Blue);
+            BlueViolet = new ImmutableSolidColorBrush(Colors.BlueViolet);
+            Brown = new ImmutableSolidColorBrush(Colors.Brown);
+            BurlyWood = new ImmutableSolidColorBrush(Colors.BurlyWood);
+            CadetBlue = new ImmutableSolidColorBrush(Colors.CadetBlue);
+            Chartreuse = new ImmutableSolidColorBrush(Colors.Chartreuse);
+            Chocolate = new ImmutableSolidColorBrush(Colors.Chocolate);
+            Coral = new ImmutableSolidColorBrush(Colors.Coral);
+            CornflowerBlue = new ImmutableSolidColorBrush(Colors.CornflowerBlue);
+            Cornsilk = new ImmutableSolidColorBrush(Colors.Cornsilk);
+            Crimson = new ImmutableSolidColorBrush(Colors.Crimson);
+            Cyan = new ImmutableSolidColorBrush(Colors.Cyan);
+            DarkBlue = new ImmutableSolidColorBrush(Colors.DarkBlue);
+            DarkCyan = new ImmutableSolidColorBrush(Colors.DarkCyan);
+            DarkGoldenrod = new ImmutableSolidColorBrush(Colors.DarkGoldenrod);
+            DarkGray = new ImmutableSolidColorBrush(Colors.DarkGray);
+            DarkGreen = new ImmutableSolidColorBrush(Colors.DarkGreen);
+            DarkKhaki = new ImmutableSolidColorBrush(Colors.DarkKhaki);
+            DarkMagenta = new ImmutableSolidColorBrush(Colors.DarkMagenta);
+            DarkOliveGreen = new ImmutableSolidColorBrush(Colors.DarkOliveGreen);
+            DarkOrange = new ImmutableSolidColorBrush(Colors.DarkOrange);
+            DarkOrchid = new ImmutableSolidColorBrush(Colors.DarkOrchid);
+            DarkRed = new ImmutableSolidColorBrush(Colors.DarkRed);
+            DarkSalmon = new ImmutableSolidColorBrush(Colors.DarkSalmon);
+            DarkSeaGreen = new ImmutableSolidColorBrush(Colors.DarkSeaGreen);
+            DarkSlateBlue = new ImmutableSolidColorBrush(Colors.DarkSlateBlue);
+            DarkSlateGray = new ImmutableSolidColorBrush(Colors.DarkSlateGray);
+            DarkTurquoise = new ImmutableSolidColorBrush(Colors.DarkTurquoise);
+            DarkViolet = new ImmutableSolidColorBrush(Colors.DarkViolet);
+            DeepPink = new ImmutableSolidColorBrush(Colors.DeepPink);
+            DeepSkyBlue = new ImmutableSolidColorBrush(Colors.DeepSkyBlue);
+            DimGray = new ImmutableSolidColorBrush(Colors.DimGray);
+            DodgerBlue = new ImmutableSolidColorBrush(Colors.DodgerBlue);
+            Firebrick = new ImmutableSolidColorBrush(Colors.Firebrick);
+            FloralWhite = new ImmutableSolidColorBrush(Colors.FloralWhite);
+            ForestGreen = new ImmutableSolidColorBrush(Colors.ForestGreen);
+            Fuchsia = new ImmutableSolidColorBrush(Colors.Fuchsia);
+            Gainsboro = new ImmutableSolidColorBrush(Colors.Gainsboro);
+            GhostWhite = new ImmutableSolidColorBrush(Colors.GhostWhite);
+            Gold = new ImmutableSolidColorBrush(Colors.Gold);
+            Goldenrod = new ImmutableSolidColorBrush(Colors.Goldenrod);
+            Gray = new ImmutableSolidColorBrush(Colors.Gray);
+            Green = new ImmutableSolidColorBrush(Colors.Green);
+            GreenYellow = new ImmutableSolidColorBrush(Colors.GreenYellow);
+            Honeydew = new ImmutableSolidColorBrush(Colors.Honeydew);
+            HotPink = new ImmutableSolidColorBrush(Colors.HotPink);
+            IndianRed = new ImmutableSolidColorBrush(Colors.IndianRed);
+            Indigo = new ImmutableSolidColorBrush(Colors.Indigo);
+            Ivory = new ImmutableSolidColorBrush(Colors.Ivory);
+            Khaki = new ImmutableSolidColorBrush(Colors.Khaki);
+            Lavender = new ImmutableSolidColorBrush(Colors.Lavender);
+            LavenderBlush = new ImmutableSolidColorBrush(Colors.LavenderBlush);
+            LawnGreen = new ImmutableSolidColorBrush(Colors.LawnGreen);
+            LemonChiffon = new ImmutableSolidColorBrush(Colors.LemonChiffon);
+            LightBlue = new ImmutableSolidColorBrush(Colors.LightBlue);
+            LightCoral = new ImmutableSolidColorBrush(Colors.LightCoral);
+            LightCyan = new ImmutableSolidColorBrush(Colors.LightCyan);
+            LightGoldenrodYellow = new ImmutableSolidColorBrush(Colors.LightGoldenrodYellow);
+            LightGray = new ImmutableSolidColorBrush(Colors.LightGray);
+            LightGreen = new ImmutableSolidColorBrush(Colors.LightGreen);
+            LightPink = new ImmutableSolidColorBrush(Colors.LightPink);
+            LightSalmon = new ImmutableSolidColorBrush(Colors.LightSalmon);
+            LightSeaGreen = new ImmutableSolidColorBrush(Colors.LightSeaGreen);
+            LightSkyBlue = new ImmutableSolidColorBrush(Colors.LightSkyBlue);
+            LightSlateGray = new ImmutableSolidColorBrush(Colors.LightSlateGray);
+            LightSteelBlue = new ImmutableSolidColorBrush(Colors.LightSteelBlue);
+            LightYellow = new ImmutableSolidColorBrush(Colors.LightYellow);
+            Lime = new ImmutableSolidColorBrush(Colors.Lime);
+            LimeGreen = new ImmutableSolidColorBrush(Colors.LimeGreen);
+            Linen = new ImmutableSolidColorBrush(Colors.Linen);
+            Magenta = new ImmutableSolidColorBrush(Colors.Magenta);
+            Maroon = new ImmutableSolidColorBrush(Colors.Maroon);
+            MediumAquamarine = new ImmutableSolidColorBrush(Colors.MediumAquamarine);
+            MediumBlue = new ImmutableSolidColorBrush(Colors.MediumBlue);
+            MediumOrchid = new ImmutableSolidColorBrush(Colors.MediumOrchid);
+            MediumPurple = new ImmutableSolidColorBrush(Colors.MediumPurple);
+            MediumSeaGreen = new ImmutableSolidColorBrush(Colors.MediumSeaGreen);
+            MediumSlateBlue = new ImmutableSolidColorBrush(Colors.MediumSlateBlue);
+            MediumSpringGreen = new ImmutableSolidColorBrush(Colors.MediumSpringGreen);
+            MediumTurquoise = new ImmutableSolidColorBrush(Colors.MediumTurquoise);
+            MediumVioletRed = new ImmutableSolidColorBrush(Colors.MediumVioletRed);
+            MidnightBlue = new ImmutableSolidColorBrush(Colors.MidnightBlue);
+            MintCream = new ImmutableSolidColorBrush(Colors.MintCream);
+            MistyRose = new ImmutableSolidColorBrush(Colors.MistyRose);
+            Moccasin = new ImmutableSolidColorBrush(Colors.Moccasin);
+            NavajoWhite = new ImmutableSolidColorBrush(Colors.NavajoWhite);
+            Navy = new ImmutableSolidColorBrush(Colors.Navy);
+            OldLace = new ImmutableSolidColorBrush(Colors.OldLace);
+            Olive = new ImmutableSolidColorBrush(Colors.Olive);
+            OliveDrab = new ImmutableSolidColorBrush(Colors.OliveDrab);
+            Orange = new ImmutableSolidColorBrush(Colors.Orange);
+            OrangeRed = new ImmutableSolidColorBrush(Colors.OrangeRed);
+            Orchid = new ImmutableSolidColorBrush(Colors.Orchid);
+            PaleGoldenrod = new ImmutableSolidColorBrush(Colors.PaleGoldenrod);
+            PaleGreen = new ImmutableSolidColorBrush(Colors.PaleGreen);
+            PaleTurquoise = new ImmutableSolidColorBrush(Colors.PaleTurquoise);
+            PaleVioletRed = new ImmutableSolidColorBrush(Colors.PaleVioletRed);
+            PapayaWhip = new ImmutableSolidColorBrush(Colors.PapayaWhip);
+            PeachPuff = new ImmutableSolidColorBrush(Colors.PeachPuff);
+            Peru = new ImmutableSolidColorBrush(Colors.Peru);
+            Pink = new ImmutableSolidColorBrush(Colors.Pink);
+            Plum = new ImmutableSolidColorBrush(Colors.Plum);
+            PowderBlue = new ImmutableSolidColorBrush(Colors.PowderBlue);
+            Purple = new ImmutableSolidColorBrush(Colors.Purple);
+            Red = new ImmutableSolidColorBrush(Colors.Red);
+            RosyBrown = new ImmutableSolidColorBrush(Colors.RosyBrown);
+            RoyalBlue = new ImmutableSolidColorBrush(Colors.RoyalBlue);
+            SaddleBrown = new ImmutableSolidColorBrush(Colors.SaddleBrown);
+            Salmon = new ImmutableSolidColorBrush(Colors.Salmon);
+            SandyBrown = new ImmutableSolidColorBrush(Colors.SandyBrown);
+            SeaGreen = new ImmutableSolidColorBrush(Colors.SeaGreen);
+            SeaShell = new ImmutableSolidColorBrush(Colors.SeaShell);
+            Sienna = new ImmutableSolidColorBrush(Colors.Sienna);
+            Silver = new ImmutableSolidColorBrush(Colors.Silver);
+            SkyBlue = new ImmutableSolidColorBrush(Colors.SkyBlue);
+            SlateBlue = new ImmutableSolidColorBrush(Colors.SlateBlue);
+            SlateGray = new ImmutableSolidColorBrush(Colors.SlateGray);
+            Snow = new ImmutableSolidColorBrush(Colors.Snow);
+            SpringGreen = new ImmutableSolidColorBrush(Colors.SpringGreen);
+            SteelBlue = new ImmutableSolidColorBrush(Colors.SteelBlue);
+            Tan = new ImmutableSolidColorBrush(Colors.Tan);
+            Teal = new ImmutableSolidColorBrush(Colors.Teal);
+            Thistle = new ImmutableSolidColorBrush(Colors.Thistle);
+            Tomato = new ImmutableSolidColorBrush(Colors.Tomato);
+            Transparent = new ImmutableSolidColorBrush(Colors.Transparent);
+            Turquoise = new ImmutableSolidColorBrush(Colors.Turquoise);
+            Violet = new ImmutableSolidColorBrush(Colors.Violet);
+            Wheat = new ImmutableSolidColorBrush(Colors.Wheat);
+            White = new ImmutableSolidColorBrush(Colors.White);
+            WhiteSmoke = new ImmutableSolidColorBrush(Colors.WhiteSmoke);
+            Yellow = new ImmutableSolidColorBrush(Colors.Yellow);
+            YellowGreen = new ImmutableSolidColorBrush(Colors.YellowGreen);
         }
 
         /// <summary>
         /// Gets an <see cref="Colors.AliceBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush AliceBlue { get; private set; }
+        public static ISolidColorBrush AliceBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.AntiqueWhite"/> colored brush.
         /// </summary>
-        public static SolidColorBrush AntiqueWhite { get; private set; }
+        public static ISolidColorBrush AntiqueWhite { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.AliceBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Aqua { get; private set; }
+        public static ISolidColorBrush Aqua { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Aquamarine"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Aquamarine { get; private set; }
+        public static ISolidColorBrush Aquamarine { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Azure"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Azure { get; private set; }
+        public static ISolidColorBrush Azure { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Beige"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Beige { get; private set; }
+        public static ISolidColorBrush Beige { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Bisque"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Bisque { get; private set; }
+        public static ISolidColorBrush Bisque { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Black"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Black { get; private set; }
+        public static ISolidColorBrush Black { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.BlanchedAlmond"/> colored brush.
         /// </summary>
-        public static SolidColorBrush BlanchedAlmond { get; private set; }
+        public static ISolidColorBrush BlanchedAlmond { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Blue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Blue { get; private set; }
+        public static ISolidColorBrush Blue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.BlueViolet"/> colored brush.
         /// </summary>
-        public static SolidColorBrush BlueViolet { get; private set; }
+        public static ISolidColorBrush BlueViolet { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Brown"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Brown { get; private set; }
+        public static ISolidColorBrush Brown { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.BurlyWood"/> colored brush.
         /// </summary>
-        public static SolidColorBrush BurlyWood { get; private set; }
+        public static ISolidColorBrush BurlyWood { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.CadetBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush CadetBlue { get; private set; }
+        public static ISolidColorBrush CadetBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Chartreuse"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Chartreuse { get; private set; }
+        public static ISolidColorBrush Chartreuse { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Chocolate"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Chocolate { get; private set; }
+        public static ISolidColorBrush Chocolate { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Coral"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Coral { get; private set; }
+        public static ISolidColorBrush Coral { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.CornflowerBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush CornflowerBlue { get; private set; }
+        public static ISolidColorBrush CornflowerBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Cornsilk"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Cornsilk { get; private set; }
+        public static ISolidColorBrush Cornsilk { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Crimson"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Crimson { get; private set; }
+        public static ISolidColorBrush Crimson { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Cyan"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Cyan { get; private set; }
+        public static ISolidColorBrush Cyan { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkBlue { get; private set; }
+        public static ISolidColorBrush DarkBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkCyan"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkCyan { get; private set; }
+        public static ISolidColorBrush DarkCyan { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkGoldenrod"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkGoldenrod { get; private set; }
+        public static ISolidColorBrush DarkGoldenrod { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkGray { get; private set; }
+        public static ISolidColorBrush DarkGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkGreen { get; private set; }
+        public static ISolidColorBrush DarkGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkKhaki"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkKhaki { get; private set; }
+        public static ISolidColorBrush DarkKhaki { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkMagenta"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkMagenta { get; private set; }
+        public static ISolidColorBrush DarkMagenta { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkOliveGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkOliveGreen { get; private set; }
+        public static ISolidColorBrush DarkOliveGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkOrange"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkOrange { get; private set; }
+        public static ISolidColorBrush DarkOrange { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkOrchid"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkOrchid { get; private set; }
+        public static ISolidColorBrush DarkOrchid { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkRed"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkRed { get; private set; }
+        public static ISolidColorBrush DarkRed { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkSalmon"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkSalmon { get; private set; }
+        public static ISolidColorBrush DarkSalmon { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkSeaGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkSeaGreen { get; private set; }
+        public static ISolidColorBrush DarkSeaGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkSlateBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkSlateBlue { get; private set; }
+        public static ISolidColorBrush DarkSlateBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkSlateGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkSlateGray { get; private set; }
+        public static ISolidColorBrush DarkSlateGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkTurquoise"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkTurquoise { get; private set; }
+        public static ISolidColorBrush DarkTurquoise { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DarkViolet"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DarkViolet { get; private set; }
+        public static ISolidColorBrush DarkViolet { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DeepPink"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DeepPink { get; private set; }
+        public static ISolidColorBrush DeepPink { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DeepSkyBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DeepSkyBlue { get; private set; }
+        public static ISolidColorBrush DeepSkyBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DimGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DimGray { get; private set; }
+        public static ISolidColorBrush DimGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.DodgerBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush DodgerBlue { get; private set; }
+        public static ISolidColorBrush DodgerBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Firebrick"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Firebrick { get; private set; }
+        public static ISolidColorBrush Firebrick { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.FloralWhite"/> colored brush.
         /// </summary>
-        public static SolidColorBrush FloralWhite { get; private set; }
+        public static ISolidColorBrush FloralWhite { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.ForestGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush ForestGreen { get; private set; }
+        public static ISolidColorBrush ForestGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Fuchsia"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Fuchsia { get; private set; }
+        public static ISolidColorBrush Fuchsia { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Gainsboro"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Gainsboro { get; private set; }
+        public static ISolidColorBrush Gainsboro { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.GhostWhite"/> colored brush.
         /// </summary>
-        public static SolidColorBrush GhostWhite { get; private set; }
+        public static ISolidColorBrush GhostWhite { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Gold"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Gold { get; private set; }
+        public static ISolidColorBrush Gold { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Goldenrod"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Goldenrod { get; private set; }
+        public static ISolidColorBrush Goldenrod { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Gray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Gray { get; private set; }
+        public static ISolidColorBrush Gray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Green"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Green { get; private set; }
+        public static ISolidColorBrush Green { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.GreenYellow"/> colored brush.
         /// </summary>
-        public static SolidColorBrush GreenYellow { get; private set; }
+        public static ISolidColorBrush GreenYellow { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Honeydew"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Honeydew { get; private set; }
+        public static ISolidColorBrush Honeydew { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.HotPink"/> colored brush.
         /// </summary>
-        public static SolidColorBrush HotPink { get; private set; }
+        public static ISolidColorBrush HotPink { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.IndianRed"/> colored brush.
         /// </summary>
-        public static SolidColorBrush IndianRed { get; private set; }
+        public static ISolidColorBrush IndianRed { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Indigo"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Indigo { get; private set; }
+        public static ISolidColorBrush Indigo { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Ivory"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Ivory { get; private set; }
+        public static ISolidColorBrush Ivory { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Khaki"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Khaki { get; private set; }
+        public static ISolidColorBrush Khaki { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Lavender"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Lavender { get; private set; }
+        public static ISolidColorBrush Lavender { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LavenderBlush"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LavenderBlush { get; private set; }
+        public static ISolidColorBrush LavenderBlush { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LawnGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LawnGreen { get; private set; }
+        public static ISolidColorBrush LawnGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LemonChiffon"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LemonChiffon { get; private set; }
+        public static ISolidColorBrush LemonChiffon { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightBlue { get; private set; }
+        public static ISolidColorBrush LightBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightCoral"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightCoral { get; private set; }
+        public static ISolidColorBrush LightCoral { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightCyan"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightCyan { get; private set; }
+        public static ISolidColorBrush LightCyan { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightGoldenrodYellow"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightGoldenrodYellow { get; private set; }
+        public static ISolidColorBrush LightGoldenrodYellow { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightGray { get; private set; }
+        public static ISolidColorBrush LightGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightGreen { get; private set; }
+        public static ISolidColorBrush LightGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightPink"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightPink { get; private set; }
+        public static ISolidColorBrush LightPink { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightSalmon"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightSalmon { get; private set; }
+        public static ISolidColorBrush LightSalmon { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightSeaGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightSeaGreen { get; private set; }
+        public static ISolidColorBrush LightSeaGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightSkyBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightSkyBlue { get; private set; }
+        public static ISolidColorBrush LightSkyBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightSlateGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightSlateGray { get; private set; }
+        public static ISolidColorBrush LightSlateGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightSteelBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightSteelBlue { get; private set; }
+        public static ISolidColorBrush LightSteelBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LightYellow"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LightYellow { get; private set; }
+        public static ISolidColorBrush LightYellow { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Lime"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Lime { get; private set; }
+        public static ISolidColorBrush Lime { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.LimeGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush LimeGreen { get; private set; }
+        public static ISolidColorBrush LimeGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Linen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Linen { get; private set; }
+        public static ISolidColorBrush Linen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Magenta"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Magenta { get; private set; }
+        public static ISolidColorBrush Magenta { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Maroon"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Maroon { get; private set; }
+        public static ISolidColorBrush Maroon { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumAquamarine"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumAquamarine { get; private set; }
+        public static ISolidColorBrush MediumAquamarine { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumBlue { get; private set; }
+        public static ISolidColorBrush MediumBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumOrchid"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumOrchid { get; private set; }
+        public static ISolidColorBrush MediumOrchid { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumPurple"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumPurple { get; private set; }
+        public static ISolidColorBrush MediumPurple { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumSeaGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumSeaGreen { get; private set; }
+        public static ISolidColorBrush MediumSeaGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumSlateBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumSlateBlue { get; private set; }
+        public static ISolidColorBrush MediumSlateBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumSpringGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumSpringGreen { get; private set; }
+        public static ISolidColorBrush MediumSpringGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumTurquoise"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumTurquoise { get; private set; }
+        public static ISolidColorBrush MediumTurquoise { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MediumVioletRed"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MediumVioletRed { get; private set; }
+        public static ISolidColorBrush MediumVioletRed { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MidnightBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MidnightBlue { get; private set; }
+        public static ISolidColorBrush MidnightBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MintCream"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MintCream { get; private set; }
+        public static ISolidColorBrush MintCream { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.MistyRose"/> colored brush.
         /// </summary>
-        public static SolidColorBrush MistyRose { get; private set; }
+        public static ISolidColorBrush MistyRose { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Moccasin"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Moccasin { get; private set; }
+        public static ISolidColorBrush Moccasin { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.NavajoWhite"/> colored brush.
         /// </summary>
-        public static SolidColorBrush NavajoWhite { get; private set; }
+        public static ISolidColorBrush NavajoWhite { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Navy"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Navy { get; private set; }
+        public static ISolidColorBrush Navy { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.OldLace"/> colored brush.
         /// </summary>
-        public static SolidColorBrush OldLace { get; private set; }
+        public static ISolidColorBrush OldLace { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Olive"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Olive { get; private set; }
+        public static ISolidColorBrush Olive { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.OliveDrab"/> colored brush.
         /// </summary>
-        public static SolidColorBrush OliveDrab { get; private set; }
+        public static ISolidColorBrush OliveDrab { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Orange"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Orange { get; private set; }
+        public static ISolidColorBrush Orange { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.OrangeRed"/> colored brush.
         /// </summary>
-        public static SolidColorBrush OrangeRed { get; private set; }
+        public static ISolidColorBrush OrangeRed { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Orchid"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Orchid { get; private set; }
+        public static ISolidColorBrush Orchid { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PaleGoldenrod"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PaleGoldenrod { get; private set; }
+        public static ISolidColorBrush PaleGoldenrod { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PaleGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PaleGreen { get; private set; }
+        public static ISolidColorBrush PaleGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PaleTurquoise"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PaleTurquoise { get; private set; }
+        public static ISolidColorBrush PaleTurquoise { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PaleVioletRed"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PaleVioletRed { get; private set; }
+        public static ISolidColorBrush PaleVioletRed { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PapayaWhip"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PapayaWhip { get; private set; }
+        public static ISolidColorBrush PapayaWhip { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PeachPuff"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PeachPuff { get; private set; }
+        public static ISolidColorBrush PeachPuff { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Peru"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Peru { get; private set; }
+        public static ISolidColorBrush Peru { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Pink"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Pink { get; private set; }
+        public static ISolidColorBrush Pink { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Plum"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Plum { get; private set; }
+        public static ISolidColorBrush Plum { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.PowderBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush PowderBlue { get; private set; }
+        public static ISolidColorBrush PowderBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Purple"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Purple { get; private set; }
+        public static ISolidColorBrush Purple { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Red"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Red { get; private set; }
+        public static ISolidColorBrush Red { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.RosyBrown"/> colored brush.
         /// </summary>
-        public static SolidColorBrush RosyBrown { get; private set; }
+        public static ISolidColorBrush RosyBrown { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.RoyalBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush RoyalBlue { get; private set; }
+        public static ISolidColorBrush RoyalBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SaddleBrown"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SaddleBrown { get; private set; }
+        public static ISolidColorBrush SaddleBrown { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Salmon"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Salmon { get; private set; }
+        public static ISolidColorBrush Salmon { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SandyBrown"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SandyBrown { get; private set; }
+        public static ISolidColorBrush SandyBrown { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SeaGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SeaGreen { get; private set; }
+        public static ISolidColorBrush SeaGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SeaShell"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SeaShell { get; private set; }
+        public static ISolidColorBrush SeaShell { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Sienna"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Sienna { get; private set; }
+        public static ISolidColorBrush Sienna { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Silver"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Silver { get; private set; }
+        public static ISolidColorBrush Silver { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SkyBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SkyBlue { get; private set; }
+        public static ISolidColorBrush SkyBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SlateBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SlateBlue { get; private set; }
+        public static ISolidColorBrush SlateBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SlateGray"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SlateGray { get; private set; }
+        public static ISolidColorBrush SlateGray { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Snow"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Snow { get; private set; }
+        public static ISolidColorBrush Snow { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SpringGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SpringGreen { get; private set; }
+        public static ISolidColorBrush SpringGreen { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.SteelBlue"/> colored brush.
         /// </summary>
-        public static SolidColorBrush SteelBlue { get; private set; }
+        public static ISolidColorBrush SteelBlue { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Tan"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Tan { get; private set; }
+        public static ISolidColorBrush Tan { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Teal"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Teal { get; private set; }
+        public static ISolidColorBrush Teal { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Thistle"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Thistle { get; private set; }
+        public static ISolidColorBrush Thistle { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Tomato"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Tomato { get; private set; }
+        public static ISolidColorBrush Tomato { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Transparent"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Transparent { get; private set; }
+        public static ISolidColorBrush Transparent { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Turquoise"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Turquoise { get; private set; }
+        public static ISolidColorBrush Turquoise { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Violet"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Violet { get; private set; }
+        public static ISolidColorBrush Violet { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Wheat"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Wheat { get; private set; }
+        public static ISolidColorBrush Wheat { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.White"/> colored brush.
         /// </summary>
-        public static SolidColorBrush White { get; private set; }
+        public static ISolidColorBrush White { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.WhiteSmoke"/> colored brush.
         /// </summary>
-        public static SolidColorBrush WhiteSmoke { get; private set; }
+        public static ISolidColorBrush WhiteSmoke { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.Yellow"/> colored brush.
         /// </summary>
-        public static SolidColorBrush Yellow { get; private set; }
+        public static ISolidColorBrush Yellow { get; private set; }
 
         /// <summary>
         /// Gets an <see cref="Colors.YellowGreen"/> colored brush.
         /// </summary>
-        public static SolidColorBrush YellowGreen { get; private set; }
+        public static ISolidColorBrush YellowGreen { get; private set; }
     }
 }

+ 16 - 0
src/Avalonia.Visuals/Media/IMutableBrush.cs

@@ -0,0 +1,16 @@
+using System;
+
+namespace Avalonia.Media
+{
+    /// <summary>
+    /// Represents a mutable brush which can return an immutable clone of itself.
+    /// </summary>
+    public interface IMutableBrush : IBrush
+    {
+        /// <summary>
+        /// Creates an immutable clone of the brush.
+        /// </summary>
+        /// <returns>The immutable clone.</returns>
+        IBrush ToImmutable();
+    }
+}

+ 47 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableGradientBrush.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// A brush that draws with a gradient.
+    /// </summary>
+    public abstract class ImmutableGradientBrush : IGradientBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableGradientBrush"/> class.
+        /// </summary>
+        /// <param name="gradientStops">The gradient stops.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="spreadMethod">The spread method.</param>
+        protected ImmutableGradientBrush(
+            IReadOnlyList<GradientStop> gradientStops,
+            double opacity,
+            GradientSpreadMethod spreadMethod)
+        {
+            GradientStops = gradientStops;
+            Opacity = opacity;
+            SpreadMethod = spreadMethod;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableGradientBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        protected ImmutableGradientBrush(IGradientBrush source)
+            : this(source.GradientStops.ToList(), source.Opacity, source.SpreadMethod)
+        {
+
+        }
+
+        /// <inheritdoc/>
+        public IReadOnlyList<GradientStop> GradientStops { get; }
+
+        /// <inheritdoc/>
+        public double Opacity { get; }
+
+        /// <inheritdoc/>
+        public GradientSpreadMethod SpreadMethod { get; }
+    }
+}

+ 58 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableImageBrush.cs

@@ -0,0 +1,58 @@
+using System;
+using Avalonia.Media.Imaging;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// Paints an area with an <see cref="IBitmap"/>.
+    /// </summary>
+    internal class ImmutableImageBrush : ImmutableTileBrush, IImageBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableImageBrush"/> class.
+        /// </summary>
+        /// <param name="source">The image to draw.</param>
+        /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
+        /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
+        /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
+        /// <param name="stretch">
+        /// How the source rectangle will be stretched to fill the destination rect.
+        /// </param>
+        /// <param name="tileMode">The tile mode.</param>
+        public ImmutableImageBrush(
+            IBitmap source,
+            AlignmentX alignmentX = AlignmentX.Center,
+            AlignmentY alignmentY = AlignmentY.Center,
+            RelativeRect? destinationRect = null,
+            double opacity = 1,
+            RelativeRect? sourceRect = null,
+            Stretch stretch = Stretch.Uniform,
+            TileMode tileMode = TileMode.None)
+            : base(
+                  alignmentX,
+                  alignmentY,
+                  destinationRect ?? RelativeRect.Fill,
+                  opacity,
+                  sourceRect ?? RelativeRect.Fill,
+                  stretch,
+                  tileMode)
+        {
+            Source = source;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableImageBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        public ImmutableImageBrush(IImageBrush source)
+            : base(source)
+        {
+            Source = source.Source;
+        }
+
+        /// <inheritdoc/>
+        public IBitmap Source { get; }
+    }
+}

+ 51 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableLinearGradientBrush.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// A brush that draws with a linear gradient.
+    /// </summary>
+    public class ImmutableLinearGradientBrush : ImmutableGradientBrush, ILinearGradientBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableLinearGradientBrush"/> class.
+        /// </summary>
+        /// <param name="gradientStops">The gradient stops.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="spreadMethod">The spread method.</param>
+        /// <param name="startPoint">The start point for the gradient.</param>
+        /// <param name="endPoint">The end point for the gradient.</param>
+        public ImmutableLinearGradientBrush(
+            IReadOnlyList<GradientStop> gradientStops,
+            double opacity = 1,
+            GradientSpreadMethod spreadMethod = GradientSpreadMethod.Pad,
+            RelativePoint? startPoint = null,
+            RelativePoint? endPoint = null)
+            : base(gradientStops, opacity, spreadMethod)
+        {
+            StartPoint = startPoint ?? RelativePoint.TopLeft;
+            EndPoint = endPoint ?? RelativePoint.BottomRight;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableLinearGradientBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        public ImmutableLinearGradientBrush(ILinearGradientBrush source)
+            : base(source)
+        {
+            StartPoint = source.StartPoint;
+            EndPoint = source.EndPoint;
+        }
+
+        /// <inheritdoc/>
+        public RelativePoint StartPoint { get; }
+
+        /// <inheritdoc/>
+        public RelativePoint EndPoint { get; }
+    }
+}

+ 59 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableRadialGradientBrush.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// A brush that draws with a radial gradient.
+    /// </summary>
+    public class ImmutableRadialGradientBrush : ImmutableGradientBrush, IRadialGradientBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableRadialGradientBrush"/> class.
+        /// </summary>
+        /// <param name="gradientStops">The gradient stops.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="spreadMethod">The spread method.</param>
+        /// <param name="center">The start point for the gradient.</param>
+        /// <param name="gradientOrigin">
+        /// The location of the two-dimensional focal point that defines the beginning of the gradient.
+        /// </param>
+        /// <param name="radius">
+        /// The horizontal and vertical radius of the outermost circle of the radial gradient.
+        /// </param>
+        public ImmutableRadialGradientBrush(
+            IReadOnlyList<GradientStop> gradientStops,
+            double opacity = 1,
+            GradientSpreadMethod spreadMethod = GradientSpreadMethod.Pad,
+            RelativePoint? center = null,
+            RelativePoint? gradientOrigin = null,
+            double radius = 0.5)
+            : base(gradientStops, opacity, spreadMethod)
+        {
+            Center = center ?? RelativePoint.Center;
+            GradientOrigin = gradientOrigin ?? RelativePoint.Center;
+            Radius = radius;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableRadialGradientBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        public ImmutableRadialGradientBrush(IRadialGradientBrush source)
+            : base(source)
+        {
+            Center = source.Center;
+            GradientOrigin = source.GradientOrigin;
+            Radius = source.Radius;
+        }
+
+        /// <inheritdoc/>
+        public RelativePoint Center { get; }
+
+        /// <inheritdoc/>
+        public RelativePoint GradientOrigin { get; }
+
+        /// <inheritdoc/>
+        public double Radius { get; }
+    }
+}

+ 59 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableSolidColorBrush.cs

@@ -0,0 +1,59 @@
+// Copyright (c) The Avalonia Project. All rights reserved.
+// Licensed under the MIT license. See licence.md file in the project root for full license information.
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// Fills an area with a solid color.
+    /// </summary>
+    public struct ImmutableSolidColorBrush : ISolidColorBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableSolidColorBrush"/> class.
+        /// </summary>
+        /// <param name="color">The color to use.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        public ImmutableSolidColorBrush(Color color, double opacity = 1)
+        {
+            Color = color;
+            Opacity = opacity;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableSolidColorBrush"/> class.
+        /// </summary>
+        /// <param name="color">The color to use.</param>
+        public ImmutableSolidColorBrush(uint color)
+            : this(Color.FromUInt32(color))
+        {
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableSolidColorBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        public ImmutableSolidColorBrush(ISolidColorBrush source)
+            : this(source.Color, source.Opacity)
+        {
+        }
+
+        /// <summary>
+        /// Gets the color of the brush.
+        /// </summary>
+        public Color Color { get; }
+
+        /// <summary>
+        /// Gets the opacity of the brush.
+        /// </summary>
+        public double Opacity { get; }
+
+        /// <summary>
+        /// Returns a string representation of the brush.
+        /// </summary>
+        /// <returns>A string representation of the brush.</returns>
+        public override string ToString()
+        {
+            return Color.ToString();
+        }
+    }
+}

+ 77 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableTileBrush.cs

@@ -0,0 +1,77 @@
+using System;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// A brush which displays a repeating image.
+    /// </summary>
+    public abstract class ImmutableTileBrush : ITileBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImageBrush"/> class.
+        /// </summary>
+        /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
+        /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
+        /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
+        /// <param name="stretch">
+        /// How the source rectangle will be stretched to fill the destination rect.
+        /// </param>
+        /// <param name="tileMode">The tile mode.</param>
+        protected ImmutableTileBrush(
+            AlignmentX alignmentX,
+            AlignmentY alignmentY,
+            RelativeRect destinationRect,
+            double opacity,
+            RelativeRect sourceRect,
+            Stretch stretch,
+            TileMode tileMode)
+        {
+            AlignmentX = alignmentX;
+            AlignmentY = alignmentY;
+            DestinationRect = destinationRect;
+            Opacity = opacity;
+            SourceRect = sourceRect;
+            Stretch = stretch;
+            TileMode = tileMode;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImageBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        protected ImmutableTileBrush(ITileBrush source)
+            : this(
+                  source.AlignmentX,
+                  source.AlignmentY,
+                  source.DestinationRect,
+                  source.Opacity,
+                  source.SourceRect,
+                  source.Stretch,
+                  source.TileMode)
+        {
+        }
+
+        /// <inheritdoc/>
+        public AlignmentX AlignmentX { get; }
+
+        /// <inheritdoc/>
+        public AlignmentY AlignmentY { get; }
+
+        /// <inheritdoc/>
+        public RelativeRect DestinationRect { get; }
+
+        /// <inheritdoc/>
+        public double Opacity { get; }
+
+        /// <inheritdoc/>
+        public RelativeRect SourceRect { get; }
+
+        /// <inheritdoc/>
+        public Stretch Stretch { get; }
+
+        /// <inheritdoc/>
+        public TileMode TileMode { get; }
+    }
+}

+ 58 - 0
src/Avalonia.Visuals/Media/Immutable/ImmutableVisualBrush.cs

@@ -0,0 +1,58 @@
+using System;
+using Avalonia.VisualTree;
+
+namespace Avalonia.Media.Immutable
+{
+    /// <summary>
+    /// Paints an area with an <see cref="IVisual"/>.
+    /// </summary>
+    internal class ImmutableVisualBrush : ImmutableTileBrush, IVisualBrush
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableImageBrush"/> class.
+        /// </summary>
+        /// <param name="visual">The visual to draw.</param>
+        /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
+        /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
+        /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
+        /// <param name="opacity">The opacity of the brush.</param>
+        /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
+        /// <param name="stretch">
+        /// How the source rectangle will be stretched to fill the destination rect.
+        /// </param>
+        /// <param name="tileMode">The tile mode.</param>
+        public ImmutableVisualBrush(
+            IVisual visual,
+            AlignmentX alignmentX = AlignmentX.Center,
+            AlignmentY alignmentY = AlignmentY.Center,
+            RelativeRect? destinationRect = null,
+            double opacity = 1,
+            RelativeRect? sourceRect = null,
+            Stretch stretch = Stretch.Uniform,
+            TileMode tileMode = TileMode.None)
+            : base(
+                  alignmentX,
+                  alignmentY,
+                  destinationRect ?? RelativeRect.Fill,
+                  opacity,
+                  sourceRect ?? RelativeRect.Fill,
+                  stretch,
+                  tileMode)
+        {
+            Visual = visual;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ImmutableVisualBrush"/> class.
+        /// </summary>
+        /// <param name="source">The brush from which this brush's properties should be copied.</param>
+        public ImmutableVisualBrush(IVisualBrush source)
+            : base(source)
+        {
+            Visual = source.Visual;
+        }
+
+        /// <inheritdoc/>
+        public IVisual Visual { get; }
+    }
+}

+ 0 - 35
src/Avalonia.Visuals/Media/Mutable/SolidColorBrush.cs

@@ -1,35 +0,0 @@
-// Copyright (c) The Avalonia Project. All rights reserved.
-// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
-namespace Avalonia.Media.Mutable
-{
-    /// <summary>
-    /// Fills an area with a solid color.
-    /// </summary>
-    /// <remarks>
-    /// This is a mutable version of the normal immutable <see cref="Avalonia.Media.SolidColorBrush"/>
-    /// for use in XAML. XAML really needs support for immutable data...
-    /// </remarks>
-    public class SolidColorBrush : Brush, ISolidColorBrush
-    {
-        public static readonly DirectProperty<SolidColorBrush, Color> ColorProperty =
-            AvaloniaProperty.RegisterDirect<SolidColorBrush, Color>(
-                "Color",
-                o => o.Color,
-                (o, v) => o.Color = v);
-
-        /// <summary>
-        /// Gets the color of the brush.
-        /// </summary>
-        public Color Color { get; set; }
-
-        /// <summary>
-        /// Returns a string representation of the brush.
-        /// </summary>
-        /// <returns>A string representation of the brush.</returns>
-        public override string ToString()
-        {
-            return Color.ToString();
-        }
-    }
-}

+ 28 - 8
src/Avalonia.Visuals/Media/SolidColorBrush.cs

@@ -1,13 +1,28 @@
 // Copyright (c) The Avalonia Project. All rights reserved.
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
+using System;
+
 namespace Avalonia.Media
 {
     /// <summary>
     /// Fills an area with a solid color.
     /// </summary>
-    public class SolidColorBrush : ISolidColorBrush
+    public class SolidColorBrush : Brush, ISolidColorBrush, IMutableBrush
     {
+        /// <summary>
+        /// Defines the <see cref="Color"/> property.
+        /// </summary>
+        public static readonly StyledProperty<Color> ColorProperty =
+            AvaloniaProperty.Register<SolidColorBrush, Color>(nameof(Color));
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SolidColorBrush"/> class.
+        /// </summary>
+        public SolidColorBrush()
+        {
+        }
+
         /// <summary>
         /// Initializes a new instance of the <see cref="SolidColorBrush"/> class.
         /// </summary>
@@ -29,14 +44,13 @@ namespace Avalonia.Media
         }
 
         /// <summary>
-        /// Gets the color of the brush.
+        /// Gets or sets the color of the brush.
         /// </summary>
-        public Color Color { get; }
-
-        /// <summary>
-        /// Gets the opacity of the brush.
-        /// </summary>
-        public double Opacity { get; }
+        public Color Color
+        {
+            get { return GetValue(ColorProperty); }
+            set { SetValue(ColorProperty, value); }
+        }
 
         /// <summary>
         /// Returns a string representation of the brush.
@@ -46,5 +60,11 @@ namespace Avalonia.Media
         {
             return Color.ToString();
         }
+
+        /// <inheritdoc/>
+        IBrush IMutableBrush.ToImmutable()
+        {
+            return new Immutable.ImmutableSolidColorBrush(this);
+        }
     }
 }

+ 1 - 2
src/Avalonia.Visuals/Properties/AssemblyInfo.cs

@@ -6,5 +6,4 @@ using Avalonia.Metadata;
 
 [assembly: AssemblyTitle("Avalonia.Visuals")]
 [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Animation")]
-[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Media")]
-[assembly: XmlnsDefinition("https://github.com/avaloniaui/mutable", "Avalonia.Media.Mutable")]
+[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Media")]

+ 1 - 1
src/Gtk/Avalonia.Cairo/Media/DrawingContext.cs

@@ -294,7 +294,7 @@ namespace Avalonia.Cairo.Media
 
         private BrushImpl CreateBrushImpl(IBrush brush, Size destinationSize)
         {
-            var solid = brush as SolidColorBrush;
+            var solid = brush as ISolidColorBrush;
             var linearGradientBrush = brush as ILinearGradientBrush;
             var radialGradientBrush = brush as IRadialGradientBrush;
             var imageBrush = brush as IImageBrush;

+ 1 - 1
src/Gtk/Avalonia.Cairo/Media/SolidColorBrushImpl.cs

@@ -5,7 +5,7 @@ namespace Avalonia.Cairo
 {
 	public class SolidColorBrushImpl : BrushImpl
 	{
-		public SolidColorBrushImpl(Avalonia.Media.SolidColorBrush brush, double opacityOverride = 1.0f)
+		public SolidColorBrushImpl(Avalonia.Media.ISolidColorBrush brush, double opacityOverride = 1.0f)
 		{
 			var color = brush?.Color.ToCairo() ?? new Color();
 

+ 4 - 5
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/Style2.xaml

@@ -1,9 +1,8 @@
 <Style xmlns="https://github.com/avaloniaui"
-       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-       xmlns:mut="https://github.com/avaloniaui/mutable">
+       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Style.Resources>
-    <mut:SolidColorBrush x:Key="RedBrush" Color="{StyleResource Red}"/>
-    <mut:SolidColorBrush x:Key="GreenBrush" Color="{StyleResource Green}"/>
-    <mut:SolidColorBrush x:Key="BlueBrush" Color="{StyleResource Blue}"/>
+    <SolidColorBrush x:Key="RedBrush" Color="{StyleResource Red}"/>
+    <SolidColorBrush x:Key="GreenBrush" Color="{StyleResource Green}"/>
+    <SolidColorBrush x:Key="BlueBrush" Color="{StyleResource Blue}"/>
   </Style.Resources>
 </Style>

+ 8 - 12
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs

@@ -124,13 +124,12 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
             {
                 var xaml = @"
 <Window xmlns='https://github.com/avaloniaui'
-        xmlns:mut='https://github.com/avaloniaui/mutable'
         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
     <Window.Styles>
         <Style>
             <Style.Resources>
                 <Color x:Key='color'>#ff506070</Color>
-                <mut:SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
+                <SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
             </Style.Resources>
         </Style>
     </Window.Styles>
@@ -139,12 +138,12 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
 
                 var loader = new AvaloniaXamlLoader();
                 var window = (Window)loader.Load(xaml);
-                var brush = (Avalonia.Media.Mutable.SolidColorBrush)window.FindStyleResource("brush");
+                var brush = (ISolidColorBrush)window.FindStyleResource("brush");
                 var button = window.FindControl<Button>("button");
 
                 DelayedBinding.ApplyBindings(button);
 
-                var buttonBrush = (Avalonia.Media.Mutable.SolidColorBrush)button.Background;
+                var buttonBrush = (ISolidColorBrush)button.Background;
 
                 Assert.Equal(0xff506070, brush.Color.ToUint32());
                 Assert.Equal(0xff506070, buttonBrush.Color.ToUint32());
@@ -156,19 +155,18 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
         {
             var xaml = @"
 <Styles xmlns='https://github.com/avaloniaui'
-        xmlns:mut='https://github.com/avaloniaui/mutable'
         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
     <Style>
         <Style.Resources>
             <Color x:Key='color'>#ff506070</Color>
-            <mut:SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
+            <SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
         </Style.Resources>
     </Style>
 </Styles>";
 
             var loader = new AvaloniaXamlLoader();
             var styles = (Styles)loader.Load(xaml);
-            var brush = (Avalonia.Media.Mutable.SolidColorBrush)styles.FindResource("brush");
+            var brush = (ISolidColorBrush)styles.FindResource("brush");
 
             Assert.Equal(0xff506070, brush.Color.ToUint32());
         }
@@ -178,7 +176,6 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
         {
             var xaml = @"
 <Styles xmlns='https://github.com/avaloniaui'
-        xmlns:mut='https://github.com/avaloniaui/mutable'
         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
     <Style>
         <Style.Resources>
@@ -187,14 +184,14 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
     </Style>
     <Style>
         <Style.Resources>
-            <mut:SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
+            <SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
         </Style.Resources>
     </Style>
 </Styles>";
 
             var loader = new AvaloniaXamlLoader();
             var styles = (Styles)loader.Load(xaml);
-            var brush = (Avalonia.Media.Mutable.SolidColorBrush)styles.FindResource("brush");
+            var brush = (ISolidColorBrush)styles.FindResource("brush");
 
             Assert.Equal(0xff506070, brush.Color.ToUint32());
         }
@@ -206,7 +203,6 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
             {
                 var xaml = @"
 <Window xmlns='https://github.com/avaloniaui'
-        xmlns:mut='https://github.com/avaloniaui/mutable'
         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
     <Window.Styles>
         <StyleInclude Source='resm:Avalonia.Markup.Xaml.UnitTests.Xaml.Style1.xaml?assembly=Avalonia.Markup.Xaml.UnitTests'/>
@@ -218,7 +214,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
                 var loader = new AvaloniaXamlLoader();
                 var window = (Window)loader.Load(xaml);
                 var border = window.FindControl<Border>("border");
-                var borderBrush = (Avalonia.Media.Mutable.SolidColorBrush)border.Background;
+                var borderBrush = (ISolidColorBrush)border.Background;
 
                 Assert.NotNull(borderBrush);
                 Assert.Equal(0xffff0000, borderBrush.Color.ToUint32());