Ejemplo n.º 1
0
        public List <System.Windows.Controls.Image> PuzzleImage(int col, int row)
        {
            var bitmaps = new List <System.Windows.Controls.Image>();

            System.IO.Directory.CreateDirectory(path);

            Rectangle rectangle = new Rectangle(0, 0, 0, 0);
            int       x = 0, y = 0, w = 0, h = 0;
            int       baseWidth  = image.Width / row;
            int       baseHeight = image.Height / col;
            string    imageName  = path.Split('\\').Last();

            for (int c = 0; c < col; c++)
            {
                for (int r = 0; r < row; r++)
                {
                    x = r * baseWidth;
                    y = c * baseHeight;
                    Image bitmap = CropImage(new Rectangle(x, y, baseWidth, baseHeight));
                    bitmap.Save(path + "//" + imageName + "_" + c + "_" + r + ".png");

                    var contrImage = new System.Windows.Controls.Image();
                    contrImage.Source = ImageModelStatic.ToWpfImage(bitmap);
                    contrImage.Tag    = Convert.ToString(c + "_" + r);
                    ImageModelStatic.RotateImage(contrImage);

                    bitmaps.Add(contrImage);
                }
            }

            return(bitmaps);
        }
Ejemplo n.º 2
0
 private void Image_RotateDown(object sender, MouseButtonEventArgs e)
 {
     ImageModelStatic.RotateImage(sender as Image);
 }