Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string srcfile  = Path.Combine(Directory.GetCurrentDirectory(), "1.jpg");
            string srcfile2 = Path.Combine(Directory.GetCurrentDirectory(), "2.jpg");
            string desfile  = Path.Combine(Directory.GetCurrentDirectory(), "op");

            Image[] imgarr  = CropJoin.splitimg(srcfile, 10, 10);
            Image[] imgarr2 = CropJoin.splitimg(srcfile2, 10, 10);
            //Image[] imgarr_original = (Image[])imgarr.Clone();
            if (checkBox_ri.Checked)
            {
                CropJoin.shuffle(imgarr2);
            }
            CropJoin.shuffle(imgarr);
            Image img = CropJoin.combineimg(imgarr, 10, 10);

            CropJoin.overlayimg(img, imgarr2, 10, 10);
            CropJoin.saveimg(img, desfile);
            pictureBox1.Image = img;
            //CropJoin.saveimg(imgarr,desfile);
            string rndn = "";
            Random rnd  = new Random();
            int    n    = 10;

            while (n > 0)
            {
                int k = (rnd.Next(1, 100) % 100);
                n--;
                rndn += k.ToString() + "   ";
            }
            textBox1.Text = rndn;
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string srcfile = Path.Combine(Directory.GetCurrentDirectory(), "allcards.jpg");
            //string srcfile2 = Path.Combine(Directory.GetCurrentDirectory(), "2.jpg");
            string desfile = Path.Combine(Directory.GetCurrentDirectory(), "op");

            Image[] imgarr = CropJoin.splitimg(srcfile, 4, 13);
            //Image[] imgarr2 = CropJoin.splitimg(srcfile2,10,10);
            //Image[] imgarr_original = (Image[])imgarr.Clone();
            //if (checkBox_ri.Checked)
            //{
            //    CropJoin.shuffle(imgarr2);
            //}
            CropJoin.shuffle(imgarr);
            Image img = CropJoin.combineimg(imgarr, 4, 13);

            //CropJoin.overlayimg(img,imgarr2,10,10);
            CropJoin.saveimg(img, desfile);
            pictureBox1.Image = img;
            //CropJoin.saveimg(imgarr,desfile);

            /*
             * imgarray = new Image[52];
             * for (int i = 0; i < 13; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      var index = i * 4 + j;
             *      Debug.Print(w1.ToString()+": "+h1.ToString());
             *      imgarray[index] = new Bitmap(w1, h1);
             *      var graphics = Graphics.FromImage(imgarray[index]);
             *      graphics.DrawImage(img, new Rectangle(0, 0, w1, h1), new Rectangle(i * w1, j * h1, w1, h1), GraphicsUnit.Pixel);
             *      graphics.Dispose();
             *  }
             * }
             * //pictureBox1.Image = imgrnd;
             *
             * Shuffle(listofindex);
             * var imgrnd = new Bitmap(w, h);
             * int rndidx = 0;
             * var graphics2 = Graphics.FromImage(imgrnd);
             * for (int i = 0; i < 13; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      var index = listofindex[rndidx];
             *      rndidx++;
             *      Debug.Print("Index: " + index);
             *      graphics2.DrawImage(imgarray[index], new Rectangle(i * w1, j * h1, w1, h1), new Rectangle(0, 0, w1, h1), GraphicsUnit.Pixel);
             *  }
             * }
             * graphics2.Dispose();
             * //pictureBox1.Image = imgarray[5];
             * pictureBox1.Image = imgrnd;
             * //pictureBox1.Image = imgarray[5];
             */
        }