ClassLibraryWeiBao/QR二维码/common/ByteMatrix.cs

(完整代码) 1KB

using System;

namespace Gma.QrCodeNet.Encoding.Common
{
    public sealed class ByteMatrix
    {
        private readonly sbyte[,] m_Bytes;
        
        internal sbyte this[int x, int y]
        {
            get { return m_Bytes[y, x]; }
            set { m_Bytes[y, x] = value; }
        }
        
        internal int Width
        {
            get { return m_Bytes.GetLength(1); }
        }

        internal int Height
        {
            get { return m_Bytes.GetLength(0); }
        }

        internal ByteMatrix(int width, int height)
        {
            m_Bytes = new sbyte[height, width];
        }

        internal void Clear(sbyte value)
        {
            this.ForAll((x, y, matrix) => { matrix[x, y] = value; });
        }

        internal void ForAll(Action<int, int, ByteMatrix> action)
        {
            for (int y = 0; y < Height; ++y)
            {
                for (int x = 0; x < Width; ++x)
                {
                    action.Invoke(x, y, this);
                }
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。