blob: 8bfc9149a9697ec813cfbc096d1cd0ea772a5c19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media.Imaging;
using Tango.SharedUI.Controls;
using Tango.SharedUI.Rendering;
public static class FrameworkElementExtensions
{
/// <summary>
/// Renders the element to bitmap file.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="filePath">The file path.</param>
/// <param name="format">The format.</param>
/// <param name="renderSize">Size of the render.</param>
/// <param name="quality">The quality.</param>
public static void RenderToFile(this FrameworkElement element, String filePath, ImageFormat format, Size renderSize, int quality)
{
RenderWindow renderer = new RenderWindow(element);
renderer.RenderToFileSynced(new Size(element.Width, element.Height), renderSize, filePath, format, quality, null);
}
}
|