Exemplo n.º 1
0
        /// <summary>
        /// Form result image from cells
        /// </summary>
        /// <param name="pathes">Matrix of path to cell images</param>
        /// <returns>Path of result image</returns>
        public string FormResult(string[,] pathes)
        {
            string      resultPath = _fileService.GetNextFilesPath(1, DirectoryType.Result)[0];
            List <Cell> cells      = new List <Cell>(pathes.Length);

            for (int i = 0; i < pathes.GetLength(0); i++)
            {
                for (int j = 0; j < pathes.GetLength(1); j++)
                {
                    cells.Add(new Cell
                    {
                        CellImage = Image.FromFile(pathes[i, j]),
                        X         = i,
                        Y         = j
                    });
                }
            }
            using (var streamSave = new FileStream(resultPath, FileMode.Create))
            {
                _imageWorkerService.FormResultImage(cells).Save(streamSave, System.Drawing.Imaging.ImageFormat.Bmp);
            }

            return(resultPath.Remove(0, resultPath.LastIndexOf("\\images\\")));
        }
Exemplo n.º 2
0
        public void FormResultImageTest1()
        {
            var rez = (Bitmap)_IImageWorker.FormResultImage(new List <Cell>());

            Assert.Null(rez);
        }