28 lines
807 B
C#
28 lines
807 B
C#
namespace Domain.Entities;
|
|
|
|
public class BinaryMask2(uint width, uint height)
|
|
{
|
|
public uint Width { get; init; } = width;
|
|
public uint Height { get; init; } = height;
|
|
|
|
private readonly bool[] _data = new bool[width * height];
|
|
|
|
public void MakeOpaque(uint x, uint y)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(x, Width);
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(y, Height);
|
|
_data[y * Width + x] = true;
|
|
}
|
|
|
|
public bool IsOpaque(uint x, uint y)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(x, Width);
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(y, Height);
|
|
return _data[y * Width + x];
|
|
}
|
|
|
|
public bool IsTransparent(uint x, uint y)
|
|
{
|
|
return !IsOpaque(x, y);
|
|
}
|
|
} |