I want my program to analyse geometric figures drawn by user. Figures must be filled with color. I have already found algorithm that checks if points are inside figure.
I have problem with getting pixel color.
Bitmap rysunek;
Pen pisak = new Pen(Color.Black, 1);
rysunek = new Bitmap(pictureBox1.Width, pictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
pictureBox1.Image = rysunek;
That is the way I connect points drawn by user: Graphics.FromImage(rysunek).DrawLine(pisak, x[i], y[j]);
and that's how I check if pixel is black:
if (rysunek.GetPixel(i, j) == Color.Black)
{
MessageBox.Show("inside");
}
Messagebox with text "inside" never appears. When I added variable in which was kept color of pixel kolor = rysunek.GetPixel(j, i);
then after reaching pixel that suppose to be black, value of kolor is: "{Name=ff000000, ARGB=(255, 0, 0, 0)}"
What am I doing wrong? Is there other way to check pixel color?