Suppose programmatically I was comparing between two images. After extracting the difference between two images suppose I store the difference in another Bitmap variable called bmp3
I got a code from another site which show how to merge the difference with first image.
Suppose that I have two Bitmap variables called bmp1 & bmp2. I extract programmatically the difference between two variable called bmp1 & bmp2 and store it in bmp3 variable.
Now I want to merge the difference with bmp1 variable just at the same position. So I got code from a site and which works fine but I have confusion about few line of that code.
Here is the code:
Bitmap bComb = new Bitmap(bmp3.Width, bmp3.Height);
using (Graphics g = Graphics.FromImage(bComb))
{
g.DrawImage(this.pictureBox1.Image, 0, 0, bComb.Width, bComb.Height);
g.DrawImage(bmp3, 0, 0, bComb.Width, bComb.Height);
}
this.pictureBox4.Image = bComb;
the meaning of this line is
Bitmap bComb = new Bitmap(bmp3.Width, bmp3.Height);
bcom is new variable which will have same size of bmp3....... am I right ?
The meaning of this line g.DrawImage(this.pictureBox1.Image, 0, 0, bComb.Width, bComb.Height); ?
We are writing picbox1 content to bcom variable from 0,0 coordinate....am I right ?
Again we are writing bmp3 content to bcom variable from 0,0 coordinate again....am I right ?
This last line is making confusion for me. why we write bmp3 variable content to bcom variable from 0,0 coordinate again....am I right ?
If we write both from 0,0 coordinate again to bcom variable then pic should over lap on each other but output is coming right. how it is being possible.
I need your help to understand those couple of line. So please discuss those line in detail and why always 0,0 coordinate is used. Please help me to understand the code. Thanks