ітівнийToolStripMenuItem_Click (object sender, EventArgs e)
{picture = new Bitmap (pictureBox1.BackgroundImage); i, x, y, n; r, g, b; rand = new Random ();. Value = 1;. Step = 1; = rand.Next (picture.Width * 30, picture.Width * 32);. Maximum = n; = 0; (i
{= rand.Next (0, picture.Width); = rand.Next (0, picture.Height); = picture.GetPixel (x, y). R + rand.Next (- 40, 40); = picture.GetPixel (x, y). G + rand.Next (-40, 40); = picture.GetPixel (x, y). B + rand.Next (-40, 40); = CorrectColor (r); = CorrectColor (g); = CorrectColor (b);. SetPixel (x, y, Color.FromArgb (r, g, b)); + +;. PerformStep ();
}. BackgroundImage = picture;. Refresh ();
} void мультипликативныйToolStripMenuItem_Click (object sender, EventArgs e)
{picture = new Bitmap (pictureBox1.BackgroundImage); i, x, y, n; r, g, b; rand = new Random ();. Value = 1;. Step = 1; = rand.Next (picture.Width * 30, picture.Width * 32);. Maximum = n; = 0; (i
{= rand.Next (0, picture.Width); = rand.Next (0, picture.Height); = picture.GetPixel (x, y). R; = picture.GetPixel ( x, y). G; = picture.GetPixel (x, y). B; = (int) (r * (rand.NextDouble () + 0.5)); = (int) (g * (rand.NextDouble () + 0.5)); = (int) (b * (rand.NextDouble () + 0.5)); = CorrectColor (r); = CorrectColor (g); = CorrectColor (b);. SetPixel (x, y, Color. FromArgb (r, g, b)); + +;. PerformStep ();
}. BackgroundImage = picture;. Refresh ();
} void імпульснийToolStripMenuItem_Click (object sender, EventArgs e)
{picture = new Bitmap (pictureBox1.BackgroundImage); i, x, y, n; r, g, b; rand = new Random ();. Value = 1;. Step = 1; = rand.Next (picture.Width * 30, picture.Width * 32);. Maximum = n; = 0; (i
{= rand.Next (0, picture.Width); = rand.Next (0, picture.Height); = rand.Next (0, 256); = rand.Next (0, 256); = rand.Next (0, 256);. SetPixel (x, y, Color.FromArgb (r, g, b)); + +;. PerformStep ();
}. BackgroundImage = picture;. Refresh ();
} void ранговаяФильтрацияToolStripMenuItem_Click (object sender, EventArgs e)
{picture = new Bitmap (pictureBox1.BackgroundImage); i, j, k, m, count; [] R, G, B; minR, minG, minB, maxR, maxG, maxB; sR , sG, sB; = new int [8]; = new int [8]; = new int [8];. Value = 1;. Step = 1;. Maximum = picture.Width * picture.Height;
// На елементи буде накладено матриця виду:
// 1 1 січня
// 1 1 січня
// 1 1 січня (i = 1; i <(picture.Width - 1); i + +)
{(j = 1; j <(picture.Height - 1); j + +)
{= 0;
// Прочитуємо рівні всіх пікселів для червоного у вікні фільтра (k = -1; k <= 1; k + +)
{(m = ...