public static Brush FromColorResource(Direct2DDevice device, ColorResource colorResource) { switch (colorResource.Type) { case ColorType.SolidColor: return(SolidColorBrush.New(colorResource.Name, device, (SolidColor)colorResource)); case ColorType.LinearGradient: return(LinearGradientBrush.New(colorResource.Name, device, (LinearGradient)colorResource)); case ColorType.RadialGradient: return(RadialGradientBrush.New(colorResource.Name, device, (RadialGradient)colorResource)); default: throw new ArgumentOutOfRangeException(string.Format("Brush type '{0}' is not valid", colorResource.Type)); } }
protected Brush(string name, Direct2DDevice device, ColorResource colorResource, SharpDX.Direct2D1.Brush brush) : base(name, device) { ColorResource = colorResource; Resource = brush; }