asp.net - Draw image with rounded corners, border and gradient fill in C# -


i've looked everywhere , googled , couldn't find good. need class able draw image (graphics) rounded corners (different on each corner plus) border , gradient fill.

all examples find have flaws (like bad quality, missing functionality etc).

i use ashx draw image , show user.

thanks!

the graphicspath allows draw relatively free form shapes can fill gradient brush. below example code create rectangle 2 differntly rounded corners , gradient fill.

    graphicspath gp = new graphicspath();     gp.addline(new point(10, 10), new point(75, 10));     gp.addarc(50, 10, 50, 50, 270, 90);     gp.addline(new point(100, 35), new point(100, 100));     gp.addarc(80, 90, 20, 20, 0, 90);     gp.addline(new point(90, 110), new point(10, 110));     gp.addline(new point(10, 110), new point(10, 10));     bitmap bm = new bitmap(110, 120);     lineargradientbrush brush = new lineargradientbrush(new point(0, 0), new point(100, 110), color.red, color.yellow);     using (graphics g = graphics.fromimage(bm))     {         g.fillpath(brush, gp);         g.drawpath(new pen(color.black, 1), gp);         g.save();     }     bm.save(@"c:\bitmap.bmp"); 

this result in following image:

alt text


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -