/// <summary> /// Exports the views to kerkythea. /// </summary> /// <param name="leftFileName"> /// Name of the left file. /// </param> /// <param name="rightFileName"> /// Name of the right file. /// </param> public void ExportKerkythea(string leftFileName, string rightFileName) { var scb = this.Background as SolidColorBrush; using (var leftExporter = new KerkytheaExporter(leftFileName)) { if (scb != null) { leftExporter.BackgroundColor = scb.Color; } leftExporter.Reflections = true; leftExporter.Shadows = true; leftExporter.SoftShadows = true; leftExporter.Width = (int)this.LeftViewport.ActualWidth; leftExporter.Height = (int)this.LeftViewport.ActualHeight; leftExporter.Export(this.LeftViewport); } using (var rightExporter = new KerkytheaExporter(rightFileName)) { if (scb != null) { rightExporter.BackgroundColor = scb.Color; } rightExporter.Reflections = true; rightExporter.Shadows = true; rightExporter.SoftShadows = true; rightExporter.Width = (int)this.RightViewport.ActualWidth; rightExporter.Height = (int)this.RightViewport.ActualHeight; rightExporter.Export(this.RightViewport); } }
/// <summary> /// Exports to kerkythea. /// </summary> /// <param name="view"> /// The view. /// </param> /// <param name="fileName"> /// Name of the file. /// </param> /// <param name="background"> /// The background. /// </param> /// <param name="width"> /// The width. /// </param> /// <param name="height"> /// The height. /// </param> private static void ExportKerkythea(Viewport3D view, string fileName, Brush background, int width, int height) { var scb = background as SolidColorBrush; var backgroundColor = scb != null ? scb.Color : Colors.White; using (var e = new KerkytheaExporter(fileName) { Width = width, Height = height, BackgroundColor = backgroundColor }) { e.Export(view); } }
private void ExportKerkythea_Click(object sender, RoutedEventArgs e) { var d = new SaveFileDialog(); d.Filter = "Kerkythea files (*.xml)|*.xml"; d.DefaultExt = ".xml"; d.FileName = @"test.xml"; // if (!d.ShowDialog().Value) return; using (var exporter = new KerkytheaExporter(d.FileName)) { var m1 = this.Resources["m1"] as Material; exporter.RegisterMaterial(m1, @"Materials\water.xml"); exporter.Export(view1.Viewport); } }
/// <summary> /// Exports the model to a Kerkythea file. /// </summary> /// <param name="view"> /// The viewport. /// </param> /// <param name="fileName"> /// Name of the file. /// </param> /// <param name="background"> /// The background. /// </param> /// <param name="width"> /// The width. /// </param> /// <param name="height"> /// The height. /// </param> private static void ExportKerkythea(this Viewport3D view, string fileName, Brush background, int width, int height) { var scb = background as SolidColorBrush; var backgroundColor = scb != null ? scb.Color : Colors.White; var e = new KerkytheaExporter { Width = width, Height = height, BackgroundColor = backgroundColor, TexturePath = System.IO.Path.GetDirectoryName(fileName) }; using (var stream = File.Create(fileName)) { e.Export(view, stream); } }
/// <summary> /// Exports the views to kerkythea. /// </summary> /// <param name="leftFileName"> /// Name of the left file. /// </param> /// <param name="rightFileName"> /// Name of the right file. /// </param> public void ExportKerkythea(string leftFileName, string rightFileName) { var scb = this.Background as SolidColorBrush; var leftExporter = new KerkytheaExporter(); if (scb != null) { leftExporter.BackgroundColor = scb.Color; } leftExporter.Reflections = true; leftExporter.Shadows = true; leftExporter.SoftShadows = true; leftExporter.Width = (int)this.LeftViewport.ActualWidth; leftExporter.Height = (int)this.LeftViewport.ActualHeight; using (var stream = File.Create(leftFileName)) { leftExporter.Export(this.LeftViewport, stream); } var rightExporter = new KerkytheaExporter(); if (scb != null) { rightExporter.BackgroundColor = scb.Color; } rightExporter.Reflections = true; rightExporter.Shadows = true; rightExporter.SoftShadows = true; rightExporter.Width = (int)this.RightViewport.ActualWidth; rightExporter.Height = (int)this.RightViewport.ActualHeight; using (var stream = File.Create(rightFileName)) { rightExporter.Export(this.RightViewport, stream); } }
private void FileExportRaw() { var path = FileDialogService.SaveFileDialog(null, null, Exporters.Filter, ".png"); if (path == null) { return; } //HelixView.Export(path); ///* Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); var ext = Path.GetExtension(path).ToLowerInvariant(); switch (ext) { case ".png": case ".jpg": HelixView.Export(path); break; case ".xaml": { var e = new XamlExporter(path); e.Export(CurrentModel); e.Close(); break; } case ".xml": { var e = new KerkytheaExporter(path); e.Export(HelixView.Viewport); e.Close(); break; } case ".obj": { var patient = new Patient(); var e = new SmileObjExporter(path); //e.Export(CurrentModel); ((SmileObjExporter)e).rawVisual = RawVisual; ((SmileObjExporter)e).Export(RawVisual, patient); e.Close(); break; } case ".objz": { var tmpPath = Path.ChangeExtension(path, ".obj"); var e = new ObjExporter(tmpPath); e.Export(CurrentModel); e.Close(); GZipHelper.Compress(tmpPath); break; } case ".x3d": { var e = new X3DExporter(path); e.Export(CurrentModel); e.Close(); break; } } showStatus(stopWatch, "Exported"); //*/ }