Skip to content

Commit

Permalink
implement boolean logic in bitmap2
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBubelnikSoftSmile committed Oct 25, 2024
1 parent 5e4885e commit 205a5e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spatial/Bitmap2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public Bitmap2(BitArray bits, Vector2i dimensions)

public AxisAlignedBox2i GridBounds => new AxisAlignedBox2i(Vector2i.Zero, Dimensions);

public BitArray Bits => (BitArray)_bits.Clone();

public bool this[int i]
{
get { return _bits[i]; }
Expand Down Expand Up @@ -178,6 +180,12 @@ public IEnumerable<Vector2i> NonZeros()

public Bitmap2 Not() => new Bitmap2(((BitArray)_bits.Clone()).Not(), _dimensions);

public Bitmap2 Or(Bitmap2 other) => new Bitmap2(((BitArray)_bits.Clone()).Or(other._bits), _dimensions);

public Bitmap2 Xor(Bitmap2 other) => new Bitmap2(((BitArray)_bits.Clone()).Xor(other._bits), _dimensions);

public Bitmap2 And(Bitmap2 other) => new Bitmap2(((BitArray)_bits.Clone()).And(other._bits), _dimensions);

public bool Equals(Bitmap2 other)
{
if (ReferenceEquals(null, other)) return false;
Expand Down

0 comments on commit 205a5e4

Please sign in to comment.