Added scaling for the image container

This commit is contained in:
RKrom 2014-06-02 10:52:33 +02:00
commit 52f56d7be5
2 changed files with 45 additions and 6 deletions

View file

@ -47,6 +47,11 @@ namespace Greenshot.Drawing {
private static readonly ILog LOG = LogManager.GetLogger(typeof(DrawableContainer));
protected static readonly EditorConfiguration EditorConfig = IniConfig.GetIniSection<EditorConfiguration>();
private bool _isMadeUndoable;
private const int M11 = 0;
private const int M12 = 1;
private const int M21 = 2;
private const int M22 = 3;
protected EditStatus _defaultEditMode = EditStatus.DRAWING;
public EditStatus DefaultEditMode {
@ -692,6 +697,24 @@ namespace Greenshot.Drawing {
Invalidate();
}
/// <summary>
/// Retrieve the Y scale from the matrix
/// </summary>
/// <param name="matrix"></param>
/// <returns></returns>
public static float CalculateScaleY(Matrix matrix) {
return matrix.Elements[M22];
}
/// <summary>
/// Retrieve the X scale from the matrix
/// </summary>
/// <param name="matrix"></param>
/// <returns></returns>
public static float CalculateScaleX(Matrix matrix) {
return matrix.Elements[M11];
}
/// <summary>
/// Retrieve the rotation angle from the matrix
/// </summary>