here is some code to create a bitmap, draw a line and srt two pixels a specific color, we then loop through pixels to find all the colored pixels…well thats what is suppose to happen, any ideas?
Bitmap bitmap = new Bitmap((int)width, (int)height))
Graphics graphics = Graphics.FromImage(bitmap))
graphics.Clear(Color.Black);
graphics.DrawLine(new Pen(new SolidBrush(Color.Blue)), (int)x1, (int)y1, (int)x2, (int)y2);
graphics.Flush();
bitmap.SetPixel((int)x1, (int)y1, Color.Red);
bitmap.SetPixel((int)x2, (int)y2, Color.Green);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
switch (bitmap.GetPixel(x, y).ToArgb())
{
case -65536: // red
case -16776961: // blue
case -16744448: // green
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WE NEVER REACH THIS PART
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
break;
}