the FreehandContainer now has a correct implementation of the Transform, thus it can be rotated/scaled/translated correctly.

This commit is contained in:
RKrom 2014-06-02 09:14:43 +02:00
commit 89c8104715

View file

@ -18,21 +18,22 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Greenshot.Drawing.Fields; using Greenshot.Drawing.Fields;
using Greenshot.Helpers; using Greenshot.Helpers;
using Greenshot.Plugin.Drawing; using Greenshot.Plugin.Drawing;
using log4net; using log4net;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.Serialization;
namespace Greenshot.Drawing { namespace Greenshot.Drawing {
/// <summary> /// <summary>
/// Description of PathContainer. /// Description of PathContainer.
/// </summary> /// </summary>
[Serializable()] [Serializable]
public class FreehandContainer : DrawableContainer { public class FreehandContainer : DrawableContainer {
private static readonly ILog LOG = LogManager.GetLogger(typeof(FreehandContainer)); private static readonly ILog LOG = LogManager.GetLogger(typeof(FreehandContainer));
private static readonly float [] POINT_OFFSET = new float[]{0.5f, 0.25f, 0.75f}; private static readonly float [] POINT_OFFSET = new float[]{0.5f, 0.25f, 0.75f};
@ -70,7 +71,16 @@ namespace Greenshot.Drawing {
} }
} }
[OnDeserialized()] public override void Transform(Matrix matrix) {
Point[] points = capturePoints.ToArray();
matrix.TransformPoints(points);
capturePoints.Clear();
capturePoints.AddRange(points);
RecalculatePath();
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context) { private void OnDeserialized(StreamingContext context) {
InitGrippers(); InitGrippers();
DoLayout(); DoLayout();