Method: UIImage#rounded
- Defined in:
- lib/sugarcube-image/uiimage.rb
#rounded(corner_radius = 5) ⇒ Object
302 303 304 305 306 307 308 309 310 |
# File 'lib/sugarcube-image/uiimage.rb', line 302 def rounded(corner_radius=5) UIGraphicsBeginImageContextWithOptions(size, false, self.scale) path = UIBezierPath.bezierPathWithRoundedRect([[0, 0], size], cornerRadius:corner_radius) path.addClip self.drawInRect([[0, 0], size]) new_image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return new_image end |