From ee911e3cdfd437f45445f784d1497f14ba960538 Mon Sep 17 00:00:00 2001 From: RKrom Date: Sat, 31 May 2014 15:55:48 +0200 Subject: [PATCH] Improved calculating the new location, when rotating. Still not correct, but it is better :) --- Greenshot/Drawing/DrawableContainerList.cs | 22 +++++++++------------- GreenshotPlugin/Core/Effects.cs | 6 ++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Greenshot/Drawing/DrawableContainerList.cs b/Greenshot/Drawing/DrawableContainerList.cs index 8de1cde17..ec5ad5893 100644 --- a/Greenshot/Drawing/DrawableContainerList.cs +++ b/Greenshot/Drawing/DrawableContainerList.cs @@ -18,19 +18,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Threading; + +using Greenshot.Configuration; using Greenshot.Drawing.Fields; using Greenshot.Memento; using Greenshot.Plugin; using Greenshot.Plugin.Drawing; -using System.Windows.Forms; using GreenshotPlugin.Core; -using Greenshot.Configuration; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; using System.Drawing.Drawing2D; +using System.Threading; +using System.Windows.Forms; namespace Greenshot.Drawing { /// @@ -134,12 +135,7 @@ namespace Greenshot.Drawing { bool modified = false; Invalidate(); foreach (var dc in this) { - //Point[] points = new Point[] { new Point(rectangle.Left, rectangle.Top), new Point(rectangle.Right, rectangle.Bottom) }; - //matrix.TransformPoints(points); - // Return that as a rectangle - //new Rectangle(points[0], new Size(points[0].X - points[1].X, points[0].Y - points[1].Y)); - - Point[] location = new Point[] { dc.Location }; + Point[] location = { dc.Location }; matrix.TransformPoints(location); dc.Left = location[0].X; diff --git a/GreenshotPlugin/Core/Effects.cs b/GreenshotPlugin/Core/Effects.cs index 87145fd86..0bec57986 100644 --- a/GreenshotPlugin/Core/Effects.cs +++ b/GreenshotPlugin/Core/Effects.cs @@ -215,14 +215,12 @@ namespace Greenshot.Core { RotateFlipType flipType; if (Angle == 90) { matrix.Rotate(90); - matrix.Translate(-sourceImage.Height, 0); - //matrix.RotateAt(90, new Point(sourceImage.Width / 2, sourceImage.Height / 2)); + matrix.Translate(0, -sourceImage.Height); flipType = RotateFlipType.Rotate90FlipNone; } else if (Angle == -90 || Angle == 270) { flipType = RotateFlipType.Rotate270FlipNone; matrix.Rotate(-90); - //matrix.RotateAt(-90, new Point(sourceImage.Width / 2, sourceImage.Height / 2)); - matrix.Translate(0, -sourceImage.Width); + matrix.Translate(-sourceImage.Width, 0); } else { throw new NotSupportedException("Currently only an angle of 90 or -90 (270) is supported."); }