|
@@ -21,6 +21,7 @@ namespace PixiEditor.Models.Tools.Tools
|
|
|
private SKPaint paint = new SKPaint() { Style = SKPaintStyle.Stroke };
|
|
|
private Coordinates[] lastChangedPixels = new Coordinates[3];
|
|
|
private byte changedPixelsindex;
|
|
|
+ private Coordinates lastChangedPixel = new Coordinates(-1, -1);
|
|
|
|
|
|
private BitmapManager BitmapManager { get; }
|
|
|
|
|
@@ -76,31 +77,36 @@ namespace PixiEditor.Models.Tools.Tools
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (previewLayer != null && previewLayer.GetPixelWithOffset(latestCords.X, latestCords.Y).Alpha > 0)
|
|
|
+ if (latestCords != lastChangedPixel)
|
|
|
{
|
|
|
- confirmedPixels.Add(latestCords);
|
|
|
- }
|
|
|
-
|
|
|
- lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
|
|
|
- SetPixelToCheck(LineTool.GetBresenhamLine(startingCoords, latestCords));
|
|
|
+ if (previewLayer != null && previewLayer.GetPixelWithOffset(latestCords.X, latestCords.Y).Alpha > 0)
|
|
|
+ {
|
|
|
+ confirmedPixels.Add(latestCords);
|
|
|
+ }
|
|
|
|
|
|
- if (changedPixelsindex == 2)
|
|
|
- {
|
|
|
- byte alpha = ApplyPixelPerfectToPixels(
|
|
|
- layer,
|
|
|
- lastChangedPixels[0],
|
|
|
- lastChangedPixels[1],
|
|
|
- lastChangedPixels[2],
|
|
|
- color,
|
|
|
- toolSize,
|
|
|
- paint);
|
|
|
+ lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
|
|
|
+ SetPixelToCheck(LineTool.GetBresenhamLine(startingCoords, latestCords));
|
|
|
|
|
|
- MovePixelsToCheck(alpha);
|
|
|
+ if (changedPixelsindex == 2)
|
|
|
+ {
|
|
|
+ byte alpha = ApplyPixelPerfectToPixels(
|
|
|
+ layer,
|
|
|
+ lastChangedPixels[0],
|
|
|
+ lastChangedPixels[1],
|
|
|
+ lastChangedPixels[2],
|
|
|
+ color,
|
|
|
+ toolSize,
|
|
|
+ paint);
|
|
|
+
|
|
|
+ MovePixelsToCheck(alpha);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- return;
|
|
|
+ changedPixelsindex += changedPixelsindex >= 2 ? (byte)0 : (byte)1;
|
|
|
}
|
|
|
|
|
|
- changedPixelsindex += changedPixelsindex >= 2 ? (byte)0 : (byte)1;
|
|
|
+ lastChangedPixel = latestCords;
|
|
|
}
|
|
|
|
|
|
private void MovePixelsToCheck(byte alpha)
|