private static TriStateMatrix XorMatrix(TriStateMatrix first, BitMatrix second) { int width = first.Width; TriStateMatrix maskedMatrix = new TriStateMatrix(width); for (int x = 0; x < width; x++) { for (int y = 0; y < width; y++) { MatrixStatus states = first.MStatus(x, y); switch (states) { case MatrixStatus.NoMask: maskedMatrix[x, y, MatrixStatus.NoMask] = first[x, y]; break; case MatrixStatus.Data: maskedMatrix[x, y, MatrixStatus.Data] = first[x, y] ^ second[x, y]; break; default: throw new ArgumentException($"{nameof(TriStateMatrix)} has None value cell.", nameof(first)); } } } return(maskedMatrix); }
public bool this[int i, int j, MatrixStatus mstatus] { set { m_stateMatrix[i, j] = mstatus; m_InternalArray[i, j] = value; } }
/// <summary> /// Sets the <see cref="System.Boolean"/> with the specified ERROR. /// </summary> /// <remarks></remarks> public bool this[int i, int j, MatrixStatus mstatus] { set { m_stateMatrix[i, j] = mstatus; m_InternalArray[i, j] = value; } }
internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint, MatrixStatus mstatus) { for (int j = 0; j < sourceArea.Size.Height; j++) { for (int i = 0; i < sourceArea.Size.Width; i++) { bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j]; target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value; } } }
/// <summary> /// Copies to. /// </summary> /// <param name="target">The target.</param> /// <param name="sourceArea">The source area.</param> /// <param name="targetPoint">The target point.</param> /// <param name="mstatus">The mstatus.</param> /// <remarks></remarks> internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint, MatrixStatus mstatus) { for (int j = 0; j < sourceArea.Size.Height; j++) { for (int i = 0; i < sourceArea.Size.Width; i++) { bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j]; target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value; } } }
internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus) { CopyTo(target, new MatrixRectangle(new MatrixPoint(0, 0), new MatrixSize(Width, Height)), targetPoint, mstatus); }
internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus) { CopyTo(target, new MatrixRectangle(new MatrixPoint(0,0), new MatrixSize(Width, Height)), targetPoint, mstatus); }
public StateMatrix(int width) { Width = width; MatrixStatus = new MatrixStatus[width, width]; }