Method: UIImage#scale_to_fill
- Defined in:
-
lib/sugarcube-image/uiimage.rb,
lib/sugarcube-image/uiimage.rb,
lib/sugarcube-image/uiimage.rb,
lib/sugarcube-image/uiimage.rb
Scales an image to fit within the given size, stretching one or both dimensions so that it completely fills the area. The current aspect ratio is maintained. If you want to place an image inside a container image, this is the method to use.
You can specify a position property, which can be a symbol or a point. It
specifies where you want the image located if it has to be cropped.
Specifying the top-left corner will display the top-left corner of the
image, likewise specifing the bottom-right corner will display that
corner. If you want the image centered, you can use the 'position-less'
version of this method (scale_to_fit()) or specify the point at the center
of the image (scale_to_fit(size, position:[w/2, h/2])), or use a symbol
(scale_to_fit(size, position: :center)).
@param scale [Numeric] image scale
65 66 67 |
# File 'lib/sugarcube-image/uiimage.rb', line 65 def scale_to_fill(new_size) scale_to_fill(new_size, position: :center) end |