aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Fill
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fill')
-rw-r--r--src/Fill/Fill.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Fill/Fill.cs b/src/Fill/Fill.cs
new file mode 100644
index 00000000..322fa5ae
--- /dev/null
+++ b/src/Fill/Fill.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+
+namespace Crow
+{
+ public abstract class Fill
+ {
+ public abstract void SetAsSource (Cairo.Context ctx, Rectangle bounds = default(Rectangle));
+ public static object Parse (string s){
+ if (string.IsNullOrEmpty (s))
+ return null;
+ if (s.Substring (1).StartsWith ("gradient"))
+ return (Gradient)Gradient.Parse (s);
+ if (s.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
+ return SvgPicture.Parse (s);
+ if (s.EndsWith (".png", true, System.Globalization.CultureInfo.InvariantCulture) ||
+ s.EndsWith (".jpg", true, System.Globalization.CultureInfo.InvariantCulture) ||
+ s.EndsWith (".jpeg", true, System.Globalization.CultureInfo.InvariantCulture) ||
+ s.EndsWith (".bmp", true, System.Globalization.CultureInfo.InvariantCulture) ||
+ s.EndsWith (".gif", true, System.Globalization.CultureInfo.InvariantCulture))
+ return BmpPicture.Parse (s);
+
+ return (SolidColor)SolidColor.Parse (s);
+ }
+
+ public static implicit operator Fill(Color c){
+ return new SolidColor (c);
+ }
+
+ }
+}
+