using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpDX.Mathematics.Interop;
namespace SharpDX.DirectManipulation
{
partial class Content
{
///
/// Retrieves the transform applied to the content.
///
public RawMatrix3x2 ContentTransform
{
get
{
var values = new float[6];
GetContentTransform(values, 6);
return ToMatrix(values);
}
}
///
/// Gets the final transform applied to the content.
///
public RawMatrix3x2 OutputTransform
{
get
{
var values = new float[6];
GetOutputTransform(values, 6);
return ToMatrix(values);
}
}
///
/// Modifies the content transform while maintaining the output transform.
///
///
public void SyncContentTransform(RawMatrix3x2 transform)
{
var values = ToArray(transform);
SyncContentTransform(values, 6);
}
///
/// Converts the float array to the equivalend .
///
/// The values to convert.
/// The converted result.
private static RawMatrix3x2 ToMatrix(float[] values)
{
return new RawMatrix3x2
{
M11 = values[0],
M12 = values[1],
M21 = values[2],
M22 = values[3],
M31 = values[4],
M32 = values[5]
};
}
///
/// Converts the to the equivalend float array.
///
/// The matrix to convert.
/// The converted result array.
private static float[] ToArray(RawMatrix3x2 matrix)
{
return new[]
{
matrix.M11, matrix.M12,
matrix.M21, matrix.M22,
matrix.M31, matrix.M32,
};
}
}
}