|
@@ -1,6 +1,7 @@
|
|
|
using PixiEditor.Models.Colors;
|
|
|
using PixiEditor.Models.Layers;
|
|
|
using PixiEditor.Models.Position;
|
|
|
+using System.Collections.Generic;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
@@ -29,10 +30,18 @@ namespace PixiEditor.Models.Tools.Tools
|
|
|
|
|
|
private BitmapPixelChanges ChangeBrightness(Layer layer, Coordinates coordinates, int toolSize, float correctionFactor)
|
|
|
{
|
|
|
- PenTool pen = new PenTool();
|
|
|
- Color pixel = layer.LayerBitmap.GetPixel(coordinates.X, coordinates.Y);
|
|
|
- Color newColor = ExColor.ChangeColorBrightness(Color.FromArgb(pixel.A,pixel.R, pixel.G, pixel.B), correctionFactor);
|
|
|
- return pen.Draw(coordinates, newColor, toolSize);
|
|
|
+ DoubleCords centeredCoords = CoordinatesCalculator.CalculateThicknessCenter(coordinates, toolSize);
|
|
|
+ Coordinates[] rectangleCoordinates = CoordinatesCalculator.RectangleToCoordinates(centeredCoords.Coords1.X, centeredCoords.Coords1.Y,
|
|
|
+ centeredCoords.Coords2.X, centeredCoords.Coords2.Y);
|
|
|
+ BitmapPixelChanges changes = new BitmapPixelChanges(new Dictionary<Coordinates, Color>());
|
|
|
+
|
|
|
+ for (int i = 0; i < rectangleCoordinates.Length; i++)
|
|
|
+ {
|
|
|
+ Color pixel = layer.LayerBitmap.GetPixel(rectangleCoordinates[i].X, rectangleCoordinates[i].Y);
|
|
|
+ Color newColor = ExColor.ChangeColorBrightness(Color.FromArgb(pixel.A, pixel.R, pixel.G, pixel.B), correctionFactor);
|
|
|
+ changes.ChangedPixels.Add(new Coordinates(rectangleCoordinates[i].X, rectangleCoordinates[i].Y), newColor);
|
|
|
+ }
|
|
|
+ return changes;
|
|
|
}
|
|
|
}
|
|
|
}
|