Esempio n. 1
0
        public Image DeShifrovkaImage(string Key)
        {
            if (rndm == null)
            {
                rndm = new Random();
            }

            using (LockBitmap Image = new LockBitmap(image))
            {
                Image.LockBits();

                string s          = Librari.DeShifrovka(RightKey, Key);
                char[] MovesRight = s.ToCharArray();
                for (int i = 0; i < Height; i++)
                {
                    int     Move      = Width - MovesRight[(i > MovesRight.Length - 1) ? MovesRight.Length - 1 : i];
                    Color[] NewPixels = new Color[Width];
                    for (int j = 0; j < Width; j++)
                    {
                        NewPixels[j] = Image.GetPixel(j, i);
                    }
                    for (int j = 0; j < Width; j++)
                    {
                        Image.SetPixel(j, i, NewPixels[(j > Move) ? j - Move : (Width - 1) - (Move - j)]);
                    }
                }

                Image.UnlockBits();
            }

            return(image);
        }
Esempio n. 2
0
 public NewImage(Photo photo, Random rn = null) : this(Librari.byteArrayToImage(photo.Image), rn, photo.RightKey)
 {
 }