Class: GdkPixbuf::Pixbuf
- Inherits:
-
Object
- Object
- GdkPixbuf::Pixbuf
- Defined in:
- lib/morandi/pixbuf_ext.rb
Overview
Add #to_cairo_image_surface for converting pixels to Cairo::ImageSurface format (RGBA->ARGB)
Direct Known Subclasses
Instance Method Summary collapse
-
#scale_max(max_size, interp = GdkPixbuf::InterpType::BILINEAR, _max_scale = 1.0) ⇒ Object
Proportionally scales down the image so that it fits within max_size*max_size square.
- #to_cairo_image_surface ⇒ Object
Instance Method Details
#scale_max(max_size, interp = GdkPixbuf::InterpType::BILINEAR, _max_scale = 1.0) ⇒ Object
Proportionally scales down the image so that it fits within max_size*max_size square
14 15 16 17 18 |
# File 'lib/morandi/pixbuf_ext.rb', line 14 def scale_max(max_size, interp = GdkPixbuf::InterpType::BILINEAR, _max_scale = 1.0) mul = (max_size / [width, height].max.to_f) mul = [1.0, mul].min scale(width * mul, height * mul, interp) end |
#to_cairo_image_surface ⇒ Object
9 10 11 |
# File 'lib/morandi/pixbuf_ext.rb', line 9 def to_cairo_image_surface GdkPixbufCairo.pixbuf_to_surface(self) end |