// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Defines the DPIAwareness type.
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Utilities
{
using System.Windows;
using System.Windows.Media;
///
/// The dpi awareness.
///
public class DPIAwareness
{
///
/// The dx.
///
private static double dx;
///
/// The dy.
///
private static double dy;
///
/// Initializes a new instance of the class.
///
public DPIAwareness()
{
var presentationSource = PresentationSource.FromVisual(Application.Current.MainWindow);
if (presentationSource != null && presentationSource.CompositionTarget != null)
{
Matrix m = presentationSource.CompositionTarget.TransformToDevice;
dx = m.M11;
dy = m.M22;
}
}
///
/// Gets the dpix.
///
public double Dpix
{
get
{
return dx;
}
}
///
/// Gets the dpi y.
///
public double DpiY
{
get
{
return dy;
}
}
}
}