Ejemplo n.º 1
0
        /// <summary>
        /// Saves the <see cref="Viewport3D" /> to a bitmap.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="stream">The output stream.</param>
        /// <param name="background">The background brush.</param>
        /// <param name="m">The oversampling multiplier.</param>
        /// <param name="format">The output format.</param>
        public static void SaveBitmap(this Viewport3D view, Stream stream, Brush background = null, int m = 1, BitmapExporter.OutputFormat format = BitmapExporter.OutputFormat.Png)
        {
            var exporter = new BitmapExporter {
                Background = background, OversamplingMultiplier = m, Format = format
            };

            exporter.Export(view, stream);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Saves the viewport to a file.
 /// </summary>
 /// <param name="view">The viewport.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="background">The background brush.</param>
 /// <param name="m">The oversampling multiplier.</param>
 /// <param name="format">The output format.</param>
 public static void SaveBitmap(this Viewport3D view, string fileName, Brush background = null, int m = 1, BitmapExporter.OutputFormat format = BitmapExporter.OutputFormat.Png)
 {
     using (var stream = File.Create(fileName))
     {
         SaveBitmap(view, stream, background, m, format);
     }
 }