Is there a MonoTouch built-in method to round the edges of a UIImage ?
I seem to remember seeing it once.
Based on BahaiResearch.com answer I've made another method for non-square images and a roundness percentage instead of a literal radius.
I'm not sure if it will produce ellipsis correctly. So I'll appreciate if some one can test or even improve this method.
private static UIImage RoundCorners (UIImage image, float roundnessPercentage)
{
float width = image.Size.Width;
float height = image.Size.Height;
float radius = ((width+height)/2) * (roundnessPercentage/(100*2));
UIGraphics.BeginImageContext (new SizeF (width, height));
CGContext c = UIGraphics.GetCurrentContext();
c.BeginPath ();
c.MoveTo(width, height/2);
//Bottom-right Corner
c.AddArcToPoint(width, height, height / 2, width, radius);
//Bottom-left Corner
c.AddArcToPoint(0, height, 0, 0, radius);
//Top-left Corner
c.AddArcToPoint(0, 0, width/2, 0, radius);
//Top-right Corner
c.AddArcToPoint(width, 0, width, height/2, radius);
c.ClosePath();
c.Clip();
image.Draw (new PointF (0, 0));
UIImage converted = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext ();
return converted;
}