Sha256: ef8a25a96b627b3f33759ff4a923a6ca90a6c2de4f4dbf5f8c0bea93099eb8e8

Contents?: true

Size: 979 Bytes

Versions: 10

Compression:

Stored size: 979 Bytes

Contents

require "forwardable"
require "tempfile"
require 'thread'

require 'rabbit/utils'

dir = File.join("rabbit", "image")
Rabbit::Utils.require_files_under_directory_in_load_path(dir)

module Rabbit
  module ImageManipulable
    extend Forwardable

    def_delegators(:@loader, :keep_ratio, :keep_ratio=)
    def_delegators(:@loader, :x_aspect_ratio, :y_aspect_ratio)
    def_delegators(:@loader, :pixbuf, :width, :height)
    def_delegators(:@loader, :original_width, :original_height)
    def_delegators(:@loader, :resize, :draw)
    def_delegators(:@loader, :[], :[]=)
    alias_method :scale, :resize

    def initialize(filename, props=nil, *args, &block)
      unless File.exist?(filename)
        raise ImageFileDoesNotExistError.new(filename)
      end
      super(*args, &block)
      props = Utils.stringify_hash_key(props) if props
      @loader = Base.find_loader(filename).new(filename, props)
    end
  end
  
  class ImageLoader
    include ImageManipulable
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rabbit-1.0.9 lib/rabbit/image.rb
rabbit-1.0.8 lib/rabbit/image.rb
rabbit-1.0.7 lib/rabbit/image.rb
rabbit-1.0.6 lib/rabbit/image.rb
rabbit-1.0.5 lib/rabbit/image.rb
rabbit-1.0.4 lib/rabbit/image.rb
rabbit-1.0.3 lib/rabbit/image.rb
rabbit-1.0.2 lib/rabbit/image.rb
rabbit-1.0.1 lib/rabbit/image.rb
rabbit-1.0.0 lib/rabbit/image.rb