Skip to content

Commit 9b07c92

Browse files
committed
Update tuple names to conform with SA1414
1 parent ac974d4 commit 9b07c92

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

Algorithms/Other/FloodFill.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Algorithms.Other;
1414
/// </summary>
1515
public static class FloodFill
1616
{
17-
private static readonly List<(int xOffset, int yOffset)> Neighbors = new() { (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1) };
17+
private static readonly List<(int XOffset, int YOffset)> Neighbors = new() { (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1) };
1818

1919
/// <summary>
2020
/// Implements the flood fill algorithm through a breadth-first approach using a queue.
@@ -23,14 +23,14 @@ public static class FloodFill
2323
/// <param name="location">The start location on the bitmap.</param>
2424
/// <param name="targetColor">The old color to be replaced.</param>
2525
/// <param name="replacementColor">The new color to replace the old one.</param>
26-
public static void BreadthFirstSearch(SKBitmap bitmap, (int x, int y) location, SKColor targetColor, SKColor replacementColor)
26+
public static void BreadthFirstSearch(SKBitmap bitmap, (int X, int Y) location, SKColor targetColor, SKColor replacementColor)
2727
{
28-
if (location.x < 0 || location.x >= bitmap.Width || location.y < 0 || location.y >= bitmap.Height)
28+
if (location.X < 0 || location.X >= bitmap.Width || location.Y < 0 || location.Y >= bitmap.Height)
2929
{
3030
throw new ArgumentOutOfRangeException(nameof(location), $"{nameof(location)} should point to a pixel within the bitmap");
3131
}
3232

33-
var queue = new List<(int x, int y)>();
33+
var queue = new List<(int X, int Y)>();
3434
queue.Add(location);
3535

3636
while (queue.Count > 0)
@@ -46,29 +46,29 @@ public static void BreadthFirstSearch(SKBitmap bitmap, (int x, int y) location,
4646
/// <param name="location">The start location on the bitmap.</param>
4747
/// <param name="targetColor">The old color to be replaced.</param>
4848
/// <param name="replacementColor">The new color to replace the old one.</param>
49-
public static void DepthFirstSearch(SKBitmap bitmap, (int x, int y) location, SKColor targetColor, SKColor replacementColor)
49+
public static void DepthFirstSearch(SKBitmap bitmap, (int X, int Y) location, SKColor targetColor, SKColor replacementColor)
5050
{
51-
if (location.x < 0 || location.x >= bitmap.Width || location.y < 0 || location.y >= bitmap.Height)
51+
if (location.X < 0 || location.X >= bitmap.Width || location.Y < 0 || location.Y >= bitmap.Height)
5252
{
5353
throw new ArgumentOutOfRangeException(nameof(location), $"{nameof(location)} should point to a pixel within the bitmap");
5454
}
5555

5656
DepthFirstFill(bitmap, location, targetColor, replacementColor);
5757
}
5858

59-
private static void BreadthFirstFill(SKBitmap bitmap, (int x, int y) location, SKColor targetColor, SKColor replacementColor, List<(int x, int y)> queue)
59+
private static void BreadthFirstFill(SKBitmap bitmap, (int X, int Y) location, SKColor targetColor, SKColor replacementColor, List<(int X, int Y)> queue)
6060
{
61-
(int x, int y) currentLocation = queue[0];
61+
(int X, int Y) currentLocation = queue[0];
6262
queue.RemoveAt(0);
6363

64-
if (bitmap.GetPixel(currentLocation.x, currentLocation.y) == targetColor)
64+
if (bitmap.GetPixel(currentLocation.X, currentLocation.Y) == targetColor)
6565
{
66-
bitmap.SetPixel(currentLocation.x, currentLocation.y, replacementColor);
66+
bitmap.SetPixel(currentLocation.X, currentLocation.Y, replacementColor);
6767

6868
for (int i = 0; i < Neighbors.Count; i++)
6969
{
70-
int x = currentLocation.x + Neighbors[i].xOffset;
71-
int y = currentLocation.y + Neighbors[i].yOffset;
70+
int x = currentLocation.X + Neighbors[i].XOffset;
71+
int y = currentLocation.Y + Neighbors[i].YOffset;
7272
if (x >= 0 && x < bitmap.Width && y >= 0 && y < bitmap.Height)
7373
{
7474
queue.Add((x, y));
@@ -77,16 +77,16 @@ private static void BreadthFirstFill(SKBitmap bitmap, (int x, int y) location, S
7777
}
7878
}
7979

80-
private static void DepthFirstFill(SKBitmap bitmap, (int x, int y) location, SKColor targetColor, SKColor replacementColor)
80+
private static void DepthFirstFill(SKBitmap bitmap, (int X, int Y) location, SKColor targetColor, SKColor replacementColor)
8181
{
82-
if (bitmap.GetPixel(location.x, location.y) == targetColor)
82+
if (bitmap.GetPixel(location.X, location.Y) == targetColor)
8383
{
84-
bitmap.SetPixel(location.x, location.y, replacementColor);
84+
bitmap.SetPixel(location.X, location.Y, replacementColor);
8585

8686
for (int i = 0; i < Neighbors.Count; i++)
8787
{
88-
int x = location.x + Neighbors[i].xOffset;
89-
int y = location.y + Neighbors[i].yOffset;
88+
int x = location.X + Neighbors[i].XOffset;
89+
int y = location.Y + Neighbors[i].YOffset;
9090
if (x >= 0 && x < bitmap.Width && y >= 0 && y < bitmap.Height)
9191
{
9292
DepthFirstFill(bitmap, (x, y), targetColor, replacementColor);

0 commit comments

Comments
 (0)