as the title says i am trying to make a darken effect(like it's in photoshop). So far i have 2 pictureboxes, one for each picture, and then the third picturebox for the output. Output should be a bitmap of the first two with the darken effect applied on them. Looks something like this - https://i.stack.imgur.com/zeS88.png
if (pixelA <= pixelB) {pixelC = pixelA}
if (pixelA > pixelB) {pixelC = pixelB}
This is the main logic of darken effect, but i dont know how to implement it in my program. This is my Form1 class
public void applyEffect(string Method)
{
imgData3 = new imgData(imgData1.img.GetLength(0), imgData1.img.GetLength(1));
for (int x = 0; x < imgData1.img.GetLength(0); x++)
{
for (int y = 0; y < imgData1.img.GetLength(1); y++)
{
imgData3.img[x, y] = new rgbiPixels();
switch(Method)
{
case "Darken":
{
imgData3.img[x, y].effectDarken(imgData1.img[x, y], imgData2.img[x, y]);
break;
}
}
}
}
pictureBox3.Image = imgData3.drawImage();
}
And this is my rgbiPixels class where i should darken just one pixel, because the rest of them are taken care in Form1 class.
public class rgbiPixels
{
public byte R;
public byte G;
public byte B;
public byte I;
public rgbiPixels()
{
R = 0;
G = 0;
B = 0;
I = 0;
}
public rgbiPixels(byte r, byte g, byte b)
{
R = r;
G = g;
B = b;
I = (byte)Math.Round(0.0722f * b + 0.7152f * g + 0.2126f * r);
}
//--------------------------------------------------
public void effectDarken(rgbiPixels a, rgbiPixels b)
{
R = Convert.ToByte(a.R + b.R);
G = Convert.ToByte(a.G + b.G);
B = Convert.ToByte(a.B + b.B);
}
//--------------------------------------------------
}
So my question is how can i implement my logic into rgbiPixels class?