blob: 322fa5aef6e0743599bc4e345237d397f2c7dd35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
}
}
}
|