add a simple plugin system
This commit is contained in:
25
Pilz.UI.Telerik.SymbolFactory/Extensions.cs
Normal file
25
Pilz.UI.Telerik.SymbolFactory/Extensions.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.Svg;
|
||||
|
||||
namespace Pilz.UI.Telerik
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static Image ToImage(this RadSvgImage svg)
|
||||
{
|
||||
return svg?.Document.Draw(svg.Width, svg.Height);
|
||||
}
|
||||
|
||||
public static void ApplyColor(this RadSvgImage svg, Color color)
|
||||
{
|
||||
svg.Document.Fill = new SvgColourServer(color);
|
||||
svg.ClearCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,10 +52,7 @@ namespace Pilz.UI.Telerik
|
||||
public virtual RadSvgImage GetSvgImageColored(TSvgSymbols svgImage, Size size, Color color)
|
||||
{
|
||||
var img = GetSvgImage(svgImage, size);
|
||||
|
||||
img.Document.Fill = new SvgColourServer(color);
|
||||
img.ClearCache();
|
||||
|
||||
img.ApplyColor(color);
|
||||
return img;
|
||||
}
|
||||
|
||||
@@ -81,7 +78,7 @@ namespace Pilz.UI.Telerik
|
||||
|
||||
public virtual Image GetImageFromSvg(RadSvgImage svg)
|
||||
{
|
||||
return svg.Document.Draw(svg.Width, svg.Height);
|
||||
return svg.ToImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user