How do I draw a rectangle onto an image with transparency and text
c#, gdi+
Solution
You can try something like this:
// Load the image (probably from your stream)
Image image = Image.FromFile( imagePath );
using (Graphics g = Graphics.FromImage(image))
{
// Modify the image using g here...
// Create a brush with an alpha value and use the g.FillRectangle function
}
image.Save( imageNewPath );
Edit: the code to create a semi transparency gray brush
Color customColor = Color.FromArgb(50, Color.Gray);
SolidBrush shadowBrush = new SolidBrush(customColor);
g.FillRectangles(shadowBrush, new RectangleF[]{rectFToFill});
Problem
This is my first graphics based project and to begin with I need to be able to draw a rectangle onto a bitmap with transparency and text. I'm not sure where to begin with this. I've done a little research but can't seem to find an article that will allow me to add a semi transparent rectangle to an image. What I will have is an image stream that I need to be able to manipulate. Can someone please point me in the right direction for this? A site with source would be great as I have never done any GDI work before.