Sha256: 370bd6196370e550c24c7fe71ed6a204a9a863741f425a3ed57fd6db594d8419

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

# Ruby2D::Image

module Ruby2D
  class Image
    include Renderable

    attr_reader :path
    attr_accessor :x, :y, :width, :height, :rotate, :data

    def initialize(path, opts = {})
      unless File.exist? path
        raise Error, "Cannot find image file `#{path}`"
      end
      @path = path
      @x = opts[:x] || 0
      @y = opts[:y] || 0
      @z = opts[:z] || 0
      @width = opts[:width] || nil
      @height = opts[:height] || nil
      @rotate = opts[:rotate] || 0
      self.color = opts[:color] || 'white'
      self.opacity = opts[:opacity] if opts[:opacity]
      ext_init(@path)
      add
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby2d-0.8.0 lib/ruby2d/image.rb