I wrote simple extension to draw things on Bitmap
:
public static void Fill(this Bitmap src, Contour contour, Color color, int xOffset = 0, int yOffset = 0)
{
foreach (var point in contour.Points)
{
src.SetPixel(point, color, xOffset, yOffset);
}
}
Then I realized, that this method is changing the src
object, which is problematic for me. I changed this method to:
public static Bitmap Fill(this Bitmap src, Contour contour, Color color, int xOffset = 0, int yOffset = 0)
{
var dst = new Bitmap(src);
foreach (var point in contour.Points)
{
dst.SetPixel(point, color, xOffset, yOffset);
}
return dst;
}
Now, src
object is immutable. Unfortunately, now my method is not working properly. No changes are aplied to dst
object. Why?