Improved calculating the new location, when rotating. Still not correct, but it is better :)

This commit is contained in:
RKrom 2014-05-31 15:55:48 +02:00
commit ee911e3cdf
2 changed files with 11 additions and 17 deletions

View file

@ -18,19 +18,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 {
/// <summary>
@ -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;

View file

@ -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.");
}