예제 #1
0
        public GridDictionarySelectorClone(IGridDictionarySelector <T> origin)
        {
            top    = origin.Y1;
            left   = origin.X1;
            width  = origin.Width;
            height = origin.Height;
            data   = new T[width, height];

            origin.Reset();
            for (x = 0; x < width; x++)
            {
                for (y = 0; y < height; y++)
                {
                    origin.MoveNext();
                    data[x, y] = origin.Current;
                }
            }
        }
예제 #2
0
 public void Set(int x, int y, IGridDictionarySelector <T> selector)
 {
     if (selector.Width <= 0 || selector.Height <= 0 ||
         x < 0 || x + selector.Width >= Width ||
         y < 0 || y + selector.Height >= Height)
     {
         return;
     }
     if (Height < y + selector.Height)
     {
         Height = (int)((y + selector.Height) * 1.5);
     }
     for (int _x = x; _x < x + selector.Width; _x++)
     {
         for (int _y = y; _y < y + selector.Height; _y++)
         {
             data[_y][_x] = selector[_x - x + selector.X1, _y - y + selector.Y1];
         }
     }
 }