I have an image created and saved manually as a file, which has a shape (e.g. a heart) that is transparent in the image, and the rest of the image has other colour. How to make the transparent shape with a specified colour programmatically in .NET, leaving the rest of the image untouched?
For example, provided is an image, which I want to fill transparent part with a colour.
http://www.sendspace.com/file/an53a1
It's transparent. So draw the background first in the color you want with Graphics.Clear(), then Graphics.DrawImage() to draw the image.
What you need is a flood fill algorithm. Please take a look at this:
http://www.codeproject.com/KB/GDI-plus/floodfillincsharp.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With