diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs index 0b668852f..394612a04 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs @@ -1,20 +1,20 @@ /* * Greenshot - a free and open source screenshot tool * Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom - * + * * For more information see: http://getgreenshot.org/ * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -35,7 +35,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// /// Description of PathContainer. /// - [Serializable] + [Serializable] public class FreehandContainer : DrawableContainer { private static readonly float [] PointOffset = {0.5f, 0.25f, 0.75f}; @@ -47,7 +47,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { [NonSerialized] private GraphicsPath _freehandPath = new GraphicsPath(); private bool _isRecalculated; - + /// /// Constructor /// @@ -65,13 +65,13 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { public override void Transform(Matrix matrix) { - var newPoints = _capturePoints.Cast().ToArray(); + var newPoints = _capturePoints.ConvertAll(p => p).ToArray(); matrix.TransformPoints(newPoints); _capturePoints.Clear(); - _capturePoints.AddRange(newPoints.Cast()); + _capturePoints.AddRange(newPoints.Select(p => (NativePointFloat)p)); RecalculatePath(); } - + protected override void OnDeserialized(StreamingContext context) { RecalculatePath(); } @@ -88,7 +88,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { } _freehandPath = null; } - + /// /// Called from Surface (the parent) when the drawing begins (mouse-down) /// @@ -137,7 +137,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { } RecalculatePath(); } - + /// /// Here we recalculate the freehand path by smoothing out the lines with Beziers. /// @@ -158,7 +158,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // duplicate points, first at 50% than 25% than 75% _capturePoints.Insert((int)(_capturePoints.Count * PointOffset[index]), _capturePoints[(int)(_capturePoints.Count * PointOffset[index++])]); } - _freehandPath.AddBeziers(_capturePoints.Cast().ToArray()); + _freehandPath.AddBeziers(_capturePoints.ConvertAll(p => p).ToArray()); } else if (_capturePoints.Count == 2) { @@ -183,7 +183,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; - + int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS); var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR); using var pen = new Pen(lineColor) {Width = lineThickness}; @@ -229,7 +229,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { selectionPen.Width = 1; graphics.DrawPath(selectionPen, selectionPath); } - + /// /// Get the bounds in which we have something drawn, plus safety margin, these are not the normal bounds... ///