Added export as PostScript
This commit is contained in:
Родитель
519f201edb
Коммит
7eb264d99b
|
@ -650,6 +650,39 @@ namespace SpiroNet.Editor
|
|||
}
|
||||
}
|
||||
|
||||
public void ExportAsPs(string path)
|
||||
{
|
||||
using (var f = System.IO.File.CreateText(path))
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append(PsBezierContext.PsProlog);
|
||||
sb.Append(string.Format(PsBezierContext.PsSize, Width, Height));
|
||||
|
||||
foreach (var shape in Shapes)
|
||||
{
|
||||
var bc = new PsBezierContext();
|
||||
|
||||
try
|
||||
{
|
||||
if (TryGetData(shape, bc))
|
||||
{
|
||||
sb.Append(bc);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Print(ex.Message);
|
||||
Debug.Print(ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append(PsBezierContext.PsPostlog);
|
||||
|
||||
f.Write(sb);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExecuteScript(string script)
|
||||
{
|
||||
var shapes = Plate.ToShapes(script);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Contexts\PsBezierContext.cs" />
|
||||
<Compile Include="Editor\SpiroEditor.cs" />
|
||||
<Compile Include="Json\JsonSerializer.cs" />
|
||||
<Compile Include="Json\ObservableCollectionContractResolver.cs" />
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace SpiroNet.Wpf
|
|||
private void Export()
|
||||
{
|
||||
var dlg = new Microsoft.Win32.SaveFileDialog();
|
||||
dlg.Filter = "Svg Files (*.svg)|*.svg|All Files (*.*)|*.*";
|
||||
dlg.Filter = "Svg Files (*.svg)|*.svg|Ps Files (*.ps)|*.ps|All Files (*.*)|*.*";
|
||||
dlg.FileName = "drawing.svg";
|
||||
|
||||
var result = dlg.ShowDialog();
|
||||
|
@ -230,6 +230,9 @@ namespace SpiroNet.Wpf
|
|||
case 1:
|
||||
_editor.ExportAsSvg(dlg.FileName);
|
||||
break;
|
||||
case 2:
|
||||
_editor.ExportAsPs(dlg.FileName);
|
||||
break;
|
||||
default:
|
||||
_editor.ExportAsSvg(dlg.FileName);
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче