示例#1
0
        public static void Shift(this Color[,] origional, Rectangle selectArea, Point newPosition)
        {
            Rectangle bounds = new Rectangle(0, 0, origional.GetLength(0), origional.GetLength(1));

            Color[,] copied = origional.Copy2D(selectArea);

            for (int x = 0; x < selectArea.Width; x++)
            {
                for (int y = 0; y < selectArea.Height; y++)
                {
                    origional[(x + newPosition.X).Wrap(bounds.X, bounds.Width), (y + newPosition.Y).Wrap(bounds.Y, bounds.Height)] = copied[x, y];
                }
            }
        }
示例#2
0
        public static void Shift(this Color[,] origional, Rect selectArea, Point newPosition)
        {
            Rect bounds = new Rect(0, 0, origional.GetLength(0), origional.GetLength(1));

            Color[,] copied = origional.Copy2D(selectArea);

            for (int x = 0; x < selectArea.width; x++)
            {
                for (int y = 0; y < selectArea.height; y++)
                {
                    origional[(x + newPosition.x).Wrap((int)bounds.x, (int)bounds.width), (y + newPosition.y).Wrap((int)bounds.y, (int)bounds.height)] = copied[x, y];
                }
            }
        }