Esempio n. 1
0
 private void OnebyOne()
 {
     byte[] answ = new byte[1];
     textBox4.Clear();
     textBox3.Clear();
     for (int i = 0; i < image.Height; i = i + 2)
     {
         bool stop = false;
         for (int j = 0; j < image.Width; j = j + 2)
         {
             char a;
             RGB = image.GetPixel(j, i);
             answ[answ.Length - 1] = WordBulder.RGBinSTR(RGB, out a);
             Array.Resize(ref answ, answ.Length + 1);
             if (a == '#')
             {
                 stop = true;
                 break;
             }
         }
         if (stop)
         {
             break;
         }
     }
     foreach (byte i in answ)
     {
         textBox4.Text += i.ToString() + " ";
     }
     textBox3.Text = Encoding.GetEncoding(1251).GetString(answ);
 }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            textBox4.Clear();
            textBox3.Clear();
            int ind = 0;

            byte[] Coding = Encoding.GetEncoding(1251).GetBytes(textBox5.Text + '#');
            foreach (byte i in Coding)
            {
                textBox4.Text += i.ToString() + " ";
            }
            for (int i = 0; i < image.Height; i++)
            {
                for (int j = 0; j < image.Width; j++)
                {
                    RGB = image.GetPixel(j, i);
                    image.SetPixel(j, i, WordBulder.ByteToColor(RGB, Coding[ind]));
                    if (Coding[ind] == 35)
                    {
                        break;
                    }
                    ind++;
                }
            }
            ind = 0;
        }
Esempio n. 3
0
        private void Diagonal()
        {
            byte[] answ = new byte[1];
            textBox4.Clear();
            textBox3.Clear();
            try
            {
                for (int i = 0; i < image.Width; i++)
                {
                    char a;
                    RGB = image.GetPixel(i, i);
                    answ[answ.Length - 1] = WordBulder.RGBinSTR(RGB, out a);
                    Array.Resize(ref answ, answ.Length + 1);
                    if (a == '#')
                    {
                        break;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error open file, choise bmp file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            foreach (byte i in answ)
            {
                textBox4.Text += i.ToString() + " ";
            }
            textBox3.Text = Encoding.GetEncoding(1251).GetString(answ);
        }