mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Trying to solve the problem that effects don't change the elements, except for the offset, by using a Matrix and than later transforming the elements. This is just the start of an idea, if this leads to nothing we can "git revert" the commit(s)...
This commit is contained in:
parent
d1ab25f852
commit
2f20c0820c
6 changed files with 92 additions and 67 deletions
|
@ -30,6 +30,7 @@ using Greenshot.Plugin.Drawing;
|
|||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.Configuration;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Greenshot.Drawing {
|
||||
/// <summary>
|
||||
|
@ -125,6 +126,34 @@ namespace Greenshot.Drawing {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply matrix to all elements
|
||||
/// </summary>
|
||||
public void Transform(Matrix matrix) {
|
||||
// Track modifications
|
||||
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 };
|
||||
matrix.TransformPoints(location);
|
||||
|
||||
dc.Left = location[0].X;
|
||||
dc.Top = location[0].Y;
|
||||
modified = true;
|
||||
}
|
||||
// Invalidate after
|
||||
Invalidate();
|
||||
// If we moved something, tell the surface it's modified!
|
||||
if (modified) {
|
||||
Parent.Modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves all elements in the list by the given amount of pixels.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue