GDI+ and drawing on a Transparent PNG

Mar 17 2005 10:13 AM
Hi, There has been a lot of great tutorials written on this subject, however they all seem to work with JPGs. I myself have no difficultly drawing on a JPG, however when I try to draw on a PNG the drawing will not show up. I have tried numerous things, my code looks like the following: Image image( txtString ); IMAGE_WIDTH = image.GetWidth(); IMAGE_HEIGHT =image.GetHeight(); graphics.DrawImage(&image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT ); Graphics imageGraphics(&image); DrawRoute(&imageGraphics); // this function draws lines on the first image. graphics.DrawImage(&image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); SaveImage(&image); The lines are drawn with Pens and Brushes that specify ARGB values, with A being 255, though I tried change the alpha levels, but that doesn't help. I've noticed one thing strange, if I take the PNG into photoshop and drop the the fill level or the opacity level by 1, the PNG will then work perfectly.. I have also tried the ColorMatrix and ImageAttributes etc.. however this doesn't look very good in what I'm trying to do.. why can't I just draw directly on top of the image like a JPG? Any help is appreciated.. Thanks in advance, Edward.

Answers (2)