Class: GdkPixbuf::Pixbuf

Inherits:
Object
  • Object
show all
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

Morandi::ProfiledPixbuf

Instance Method Summary collapse

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_surfaceObject



9
10
11
# File 'lib/morandi/pixbuf_ext.rb', line 9

def to_cairo_image_surface
  GdkPixbufCairo.pixbuf_to_surface(self)
end