public void SaveSvg_TestPlot_ValidSvgFile() { var plotModel = TestModels.CreateTestModel1(); const string FileName = "PlotModelTests_Test1.svg"; var rc = new ShapesRenderContext(null); var svg = plotModel.ToSvg(800, 500, false, rc); File.WriteAllText(FileName, svg); SvgAssert.IsValidFile(FileName); }
public void WriteText() { const string FileName = "SvgWriterTests_WriteText.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WriteText(new ScreenPoint(10, 10), "Hello world!", OxyColors.Black, "Arial", 20, FontWeights.Bold); } } SvgAssert.IsValidFile(FileName); }
public void Export_TestPlot_ValidSvgString() { var plotModel = new PlotModel("Test plot"); const string FileName = "SvgExporterTests_Plot1.svg"; plotModel.Series.Add(new FunctionSeries(Math.Sin, 0, Math.PI * 8, 200, "Math.Sin")); using (var s = File.Create(FileName)) { var rc = new ShapesRenderContext(null); SvgExporter.Export(plotModel, s, 800, 500, true, rc); } SvgAssert.IsValidFile(FileName); }
public void Export_TestPlot_ValidSvgString() { var plotModel = new PlotModel { Title = "Test plot" }; const string FileName = "SvgExporterTests_Plot1.svg"; plotModel.Series.Add(new FunctionSeries(Math.Sin, 0, Math.PI * 8, 200, "Math.Sin")); using (var s = File.Create(FileName)) { SvgExporter.Export(plotModel, s, 800, 500, true); } SvgAssert.IsValidFile(FileName); }
public void WritePolyline() { const string FileName = "SvgWriterTests_WritePolyLine.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WritePolyline( CreatePointList(), w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2, LineStyleHelper.GetDashArray(LineStyle.Solid))); } } SvgAssert.IsValidFile(FileName); }
public void WriteLine() { const string FileName = "SvgWriterTests_WriteLine.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WriteLine( new ScreenPoint(10, 10), new ScreenPoint(150, 80), w.CreateStyle(OxyColors.Undefined, OxyColors.Black, 2, LineStyle.Solid.GetDashArray())); } } SvgAssert.IsValidFile(FileName); }
public void WriteClippedImage() { const string FileName = "SvgWriterTests_WriteClippedImage.svg"; var image = CreateImage(); using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 400, 400)) { w.WriteImage(0, 0, 400, 200, image); w.WriteRectangle(100, 50, 200, 100, w.CreateStyle(OxyColors.Undefined, OxyColors.Black, 1)); w.WriteImage(1, 0.5, 2, 1, 100, 250, 200, 100, image); } } SvgAssert.IsValidFile(FileName); }
public void WriteClippedEllipse() { const string FileName = "SvgWriterTests_WriteClippedEllipse.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WriteRectangle(5, 5, 95, 45, w.CreateStyle(OxyColors.LightGreen, OxyColors.Undefined, 0)); w.BeginClip(5, 5, 95, 45); w.WriteEllipse(10, 10, 100, 60, w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2)); w.EndClip(); w.Flush(); } } SvgAssert.IsValidFile(FileName); }
public void WriteRectangle() { const string FileName = "SvgWriterTests_WriteRectangle.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WriteRectangle( 10, 20, 150, 80, w.CreateStyle(OxyColors.Green, OxyColors.Black, 2, LineStyle.Solid.GetDashArray())); } } SvgAssert.IsValidFile(FileName); }
public void WriteImage() { const string FileName = "SvgWriterTests_WriteImage.svg"; var image = CreateImage(); using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 500, 300)) { for (int y = 0; y <= 200; y += 20) { w.WriteLine(new ScreenPoint(0, y), new ScreenPoint(400, y), w.CreateStyle(OxyColors.Undefined, OxyColors.Black, 1)); } w.WriteImage(0, 0, 400, 200, image); } } SvgAssert.IsValidFile(FileName); }
public void WriteEllipse() { const string FileName = "SvgWriterTests_WriteEllipse.svg"; using (var s = File.Create(FileName)) { using (var w = new SvgWriter(s, 200, 200)) { w.WriteEllipse( 10, 10, 100, 60, w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2, LineStyle.Solid.GetDashArray()), EdgeRenderingMode.Adaptive); } } SvgAssert.IsValidFile(FileName); }