Sha256: 2d6015074935f119a5cc3a1ab0928927232f298287fd95d60d986a445ef2a8f9
Contents?: true
Size: 914 Bytes
Versions: 1
Compression:
Stored size: 914 Bytes
Contents
class UIImage def uiimage ; self ; end def uicolor(alpha=nil) color = UIColor.colorWithPatternImage(self) if not alpha.nil? color = color.colorWithAlphaComponent(alpha.to_f) end color end def uiimageview @uiimageview = UIImageView.alloc.initWithImage(self) end ##| ##| REALLY HANDY STUFF! ##| def scale_to new_size UIGraphicsBeginImageContextWithOptions(new_size, false, 0.0) self.drawInRect([[0, 0], new_size]) image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image end def rounded(corner_radius=5) UIGraphicsBeginImageContext(size) path = UIBezierPath.bezierPathWithRoundedRect([[0, 0], size], cornerRadius:corner_radius) path.addClip self.drawInRect([[0, 0], size]) image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.11 | lib/sugarcube/uiimage.rb |