public IBrush ToItem(AGSSerializationContext context) { switch (Type) { case BrushType.Solid: return(_brushes.LoadSolidBrush(Color.FromHexa(MainColor))); case BrushType.Linear: return(_brushes.LoadLinearBrush(LinearColors.Select(c => Color.FromHexa(c)).ToArray(), Blend.ToItem(context), InterpolationColors.ToItem(context), Transform.ToItem(context), WrapMode, GammaCorrection)); case BrushType.Hatch: return(_brushes.LoadHatchBrush(HatchStyle, Color.FromHexa(MainColor), Color.FromHexa(BackgroundColor))); case BrushType.Path: return(_brushes.LoadPathsGradientBrush(Color.FromHexa(MainColor), CenterPoint.ToItem(context), Blend.ToItem(context), FocusScales.ToItem(context), LinearColors.Select(c => Color.FromHexa(c)).ToArray(), InterpolationColors.ToItem(context), Transform.ToItem(context), WrapMode)); default: throw new NotSupportedException(Type + " brush is not supported!"); } }