class Rabbit::ImageDataLoader
Attributes
animation[R]
height[R]
pixbuf[R]
width[R]
Public Class Methods
new(data)
click to toggle source
# File lib/rabbit/image-data-loader.rb, line 25 def initialize(data) @width = 0 @height = 0 @pixbuf = nil @animation = nil @data = data end
Public Instance Methods
load()
click to toggle source
# File lib/rabbit/image-data-loader.rb, line 33 def load loader = GdkPixbuf::PixbufLoader.new id = loader.signal_connect("size_prepared") do |l, width, height| @width = width @height = height end begin loader.last_write(@data) rescue GdkPixbuf::PixbufError => error loader.close rescue GdkPixbuf::PixbufError raise ImageLoadError.new(error.message) end loader.signal_handler_disconnect(id) @pixbuf = loader.pixbuf @animation = loader.animation @pixbuf end