public SliceContract GetSlice(Texture2D image, LayoutContract layoutContract)
        {
            var scale = GetSliceScale(image, layoutContract);
            var offset = (scale - new Point(layoutContract.Width, layoutContract.Height)) / 2;
            var vertexes = GetVertexes(layoutContract, offset);
            var lines = GetLines(vertexes);

            return new SliceContract { Vertexes = vertexes, Lines = lines, Width = scale.X, Height = scale.Y };
        }
 private Point GetSliceScale(Texture2D image, LayoutContract layoutContract)
 {
     if (image.width * layoutContract.Height > image.height * layoutContract.Width)
     {
         return new Point(image.width * layoutContract.Height / image.height, layoutContract.Height);
     }
     else
     {
         return new Point(layoutContract.Width, image.height * layoutContract.Width / image.width);
     }
 }
        protected override Point[,] GetVertexes(LayoutContract layoutContract, Point offset)
        {
            var rows = layoutContract.Rows + 1;
            var columns = layoutContract.Columns + 1;
            var vertexes = new Point[rows, columns];

            for (var i = 0; i < rows; i++)
            {
                for (var j = 0; j < columns; j++)
                {
                    vertexes[i, j] = offset + new Point(layoutContract.Width * j / layoutContract.Columns, layoutContract.Height * i / layoutContract.Rows);
                }
            }

            return vertexes;
        }
        protected override Point[,] GetVertexes(LayoutContract layoutContract, Point offset)
        {
            var rows = layoutContract.Rows + 1;
            var columns = layoutContract.Columns + 1;
            var vertexes = new Point[rows, columns];
            var randomRange = layoutContract.Height / layoutContract.Rows / 10;

            for (var i = 0; i < rows; i++)
            {
                for (var j = 0; j < columns; j++)
                {
                    vertexes[i, j] = offset + new Point(layoutContract.Width * j / layoutContract.Columns, layoutContract.Height * i / layoutContract.Rows) + GetRandomOffset(j != 0 && j != columns - 1, i != 0 && i != rows - 1, randomRange);
                }
            }

            return vertexes;
        }
 public SliceContract GetSlice(Texture2D image, LayoutContract layoutContract, SlicePattern slicePattern)
 {
     var sliceStrategy = _sliceStrategyFactory.Create(slicePattern);
     return sliceStrategy.GetSlice(image, layoutContract);
 }
 protected abstract Point[,] GetVertexes(LayoutContract layoutContract, Point offset);