|
@@ -158,27 +158,15 @@ namespace PixiEditor.Models.Tools.Tools
|
|
|
return outputCoordinates;
|
|
|
}
|
|
|
|
|
|
- private Coordinates[] FallbackRectangle(double halfWidth, double halfHeight, double centerX, double centerY)
|
|
|
+ public IEnumerable<Coordinates> CalculateFillForEllipse(IEnumerable<Coordinates> outlineCoordinates)
|
|
|
{
|
|
|
- List<Coordinates> coordinates = new List<Coordinates>();
|
|
|
- for (double x = centerX - halfWidth; x <= centerX + halfWidth; x++)
|
|
|
- {
|
|
|
- coordinates.Add(new Coordinates((int)x, (int)(centerY - halfHeight)));
|
|
|
- coordinates.Add(new Coordinates((int)x, (int)(centerY + halfHeight)));
|
|
|
- }
|
|
|
+ List<Coordinates> finalCoordinates = new List<Coordinates>();
|
|
|
|
|
|
- for (double y = centerY - halfHeight + 1; y <= centerY + halfHeight - 1; y++)
|
|
|
+ if (!outlineCoordinates.Any())
|
|
|
{
|
|
|
- coordinates.Add(new Coordinates((int)(centerX - halfWidth), (int)y));
|
|
|
- coordinates.Add(new Coordinates((int)(centerX + halfWidth), (int)y));
|
|
|
+ return finalCoordinates;
|
|
|
}
|
|
|
|
|
|
- return coordinates.ToArray();
|
|
|
- }
|
|
|
-
|
|
|
- private IEnumerable<Coordinates> CalculateFillForEllipse(IEnumerable<Coordinates> outlineCoordinates)
|
|
|
- {
|
|
|
- List<Coordinates> finalCoordinates = new List<Coordinates>();
|
|
|
int bottom = outlineCoordinates.Max(x => x.Y);
|
|
|
int top = outlineCoordinates.Min(x => x.Y);
|
|
|
for (int i = top + 1; i < bottom; i++)
|
|
@@ -195,6 +183,24 @@ namespace PixiEditor.Models.Tools.Tools
|
|
|
return finalCoordinates;
|
|
|
}
|
|
|
|
|
|
+ private Coordinates[] FallbackRectangle(double halfWidth, double halfHeight, double centerX, double centerY)
|
|
|
+ {
|
|
|
+ List<Coordinates> coordinates = new List<Coordinates>();
|
|
|
+ for (double x = centerX - halfWidth; x <= centerX + halfWidth; x++)
|
|
|
+ {
|
|
|
+ coordinates.Add(new Coordinates((int)x, (int)(centerY - halfHeight)));
|
|
|
+ coordinates.Add(new Coordinates((int)x, (int)(centerY + halfHeight)));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (double y = centerY - halfHeight + 1; y <= centerY + halfHeight - 1; y++)
|
|
|
+ {
|
|
|
+ coordinates.Add(new Coordinates((int)(centerX - halfWidth), (int)y));
|
|
|
+ coordinates.Add(new Coordinates((int)(centerX + halfWidth), (int)y));
|
|
|
+ }
|
|
|
+
|
|
|
+ return coordinates.ToArray();
|
|
|
+ }
|
|
|
+
|
|
|
private Coordinates[] GetRegionPoints(double x, double xc, double y, double yc)
|
|
|
{
|
|
|
Coordinates[] outputCoordinates = new Coordinates[4];
|