Sha256: a5518b8150cf0e1d0dc8390c7a9c9e42f2966ffe32e735d7629688ad34a8b3a0

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

require 'gdk_pixbuf2'

# GdkPixbuf module / hierachy
module GdkPixbuf
  # Add #to_cairo_image_surface for converting pixels to Cairo::ImageSurface format (RGBA->ARGB)
  class Pixbuf
    def to_cairo_image_surface
      GdkPixbufCairo.pixbuf_to_surface(self)
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
morandi-0.99.03 lib/morandi/pixbuf_ext.rb