This commit is contained in:
TheXamlGuy
2024-04-26 23:05:36 +01:00
parent 9f90ef693d
commit bc55c4649b
206 changed files with 3106 additions and 3204 deletions
@@ -1,32 +1,31 @@
using System.Collections;
using System.Collections.Generic;
namespace Gma.QrCodeNet.Encoding;
internal struct MatrixRectangle : IEnumerable<MatrixPoint>
{
internal MatrixRectangle(MatrixPoint location, MatrixSize size) :
this()
{
Location = location;
Size = size;
}
internal MatrixRectangle(MatrixPoint location, MatrixSize size) :
this()
{
Location = location;
Size = size;
}
public MatrixPoint Location { get; private set; }
public MatrixSize Size { get; private set; }
public MatrixPoint Location { get; private set; }
public MatrixSize Size { get; private set; }
public IEnumerator<MatrixPoint> GetEnumerator()
{
for (int j = Location.Y; j < Location.Y + Size.Height; j++)
{
for (int i = Location.X; i < Location.X + Size.Width; i++)
{
yield return new MatrixPoint(i, j);
}
}
}
public IEnumerator<MatrixPoint> GetEnumerator()
{
for (int j = Location.Y; j < Location.Y + Size.Height; j++)
{
for (int i = Location.X; i < Location.X + Size.Width; i++)
{
yield return new MatrixPoint(i, j);
}
}
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public override string ToString() => $"Rectangle({Location.X};{Location.Y}):({Size.Width} x {Size.Height})";
}
public override string ToString() => $"Rectangle({Location.X};{Location.Y}):({Size.Width} x {Size.Height})";
}