Sha256: 27b46e8bed84f0ff774c1b968d8fcb67c14d7ae0a265800d5c9c71a136dcc7db
Contents?: true
Size: 476 Bytes
Versions: 1
Compression:
Stored size: 476 Bytes
Contents
# # creates a new image that fits the given size # class UnderOs::Image def resize(size) size = UOS::Point.new(size) ratio = size.x * 2 / @_.size.width new_size = CGSizeMake(size.x * 2, @_.size.height * ratio) UIGraphicsBeginImageContext(new_size) @_.drawInRect(CGRectMake(0,0,new_size.width,new_size.height)) new_image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() self.class.new(new_image) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
under-os-image-1.0.0 | lib/under_os/image/resize.rb |