mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
Fix incorrect casting for Freehand tool.
This commit is contained in:
parent
7e9c893575
commit
c1e9c72968
1 changed files with 14 additions and 14 deletions
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
|
|||
/// <summary>
|
||||
/// Description of PathContainer.
|
||||
/// </summary>
|
||||
[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;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
|
@ -65,13 +65,13 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
|
|||
|
||||
public override void Transform(Matrix matrix)
|
||||
{
|
||||
var newPoints = _capturePoints.Cast<PointF>().ToArray();
|
||||
var newPoints = _capturePoints.ConvertAll<PointF>(p => p).ToArray();
|
||||
matrix.TransformPoints(newPoints);
|
||||
_capturePoints.Clear();
|
||||
_capturePoints.AddRange(newPoints.Cast<NativePointFloat>());
|
||||
_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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called from Surface (the parent) when the drawing begins (mouse-down)
|
||||
/// </summary>
|
||||
|
@ -137,7 +137,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
|
|||
}
|
||||
RecalculatePath();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Here we recalculate the freehand path by smoothing out the lines with Beziers.
|
||||
/// </summary>
|
||||
|
@ -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<PointF>().ToArray());
|
||||
_freehandPath.AddBeziers(_capturePoints.ConvertAll<PointF>(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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the bounds in which we have something drawn, plus safety margin, these are not the normal bounds...
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue