Found that the matrix is prepending, which explains why the translation needed wrong values.

This commit is contained in:
RKrom 2014-06-01 11:25:27 +02:00
commit 5cb877f8c8

View file

@ -214,13 +214,13 @@ namespace Greenshot.Core {
public Image Apply(Image sourceImage, Matrix matrix) { public Image Apply(Image sourceImage, Matrix matrix) {
RotateFlipType flipType; RotateFlipType flipType;
if (Angle == 90) { if (Angle == 90) {
matrix.Rotate(90); matrix.Rotate(90, MatrixOrder.Append);
matrix.Translate(0, -sourceImage.Height); matrix.Translate(sourceImage.Height, 0, MatrixOrder.Append);
flipType = RotateFlipType.Rotate90FlipNone; flipType = RotateFlipType.Rotate90FlipNone;
} else if (Angle == -90 || Angle == 270) { } else if (Angle == -90 || Angle == 270) {
flipType = RotateFlipType.Rotate270FlipNone; flipType = RotateFlipType.Rotate270FlipNone;
matrix.Rotate(-90); matrix.Rotate(-90, MatrixOrder.Append);
matrix.Translate(-sourceImage.Width, 0); matrix.Translate(0, sourceImage.Width, MatrixOrder.Append);
} else { } else {
throw new NotSupportedException("Currently only an angle of 90 or -90 (270) is supported."); throw new NotSupportedException("Currently only an angle of 90 or -90 (270) is supported.");
} }