ClassLibraryWeiBao/QR二维码/MatrixRectangle.cs

(完整代码) 1KB

using System;
using System.Collections;
using System.Collections.Generic;

namespace Gma.QrCodeNet.Encoding
{
    internal struct MatrixRectangle : IEnumerable<MatrixPoint>
    {
        public MatrixPoint Location { get; private set; }
        public MatrixSize Size { get; private set; }

        internal MatrixRectangle(MatrixPoint location, MatrixSize size) :
            this()
        {
            Location = location;
            Size = size;
        }

        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()
        {
            return GetEnumerator();
        }

        public override string ToString()
        {
            return string.Format("Rectangle({0};{1}):({2} x {3})", Location.X, Location.Y, Size.Width, Size.Height);
        }
    }
}

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

AI 解读 AI

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

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