Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button4_Click(object sender, EventArgs e) {
- objBitmap4 = new Bitmap(objBitmap1);
- int a = Convert.ToInt16(textBox1.Text);
- for (int x = 0; x < objBitmap1.Width; x++)
- {
- for (int y = 0; y < objBitmap1.Height; y++)
- {
- Color w = objBitmap1.GetPixel(x, y);
- int xg = (int)((w.R + w.G + w.B) / 3);
- int xb = xg + a;
- xb = xb > 255 ? 255 : xb;
- xb = xb < 0 ? 0 : xb;
- Color new_w = Color.FromArgb(xb, xb, xb);
- objBitmap4.SetPixel(x, y, new_w);
- }
- }
- pictureBox4.Image = objBitmap4;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement