Class: Rays::Image

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable
Defined in:
lib/rays/image.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, pixel_density: 1, smooth: false) ⇒ Image

Returns a new instance of Image.



17
18
19
# File 'lib/rays/image.rb', line 17

def initialize(*args, pixel_density: 1, smooth: false)
  initialize! args, pixel_density, smooth
end

Class Method Details

.load(path) ⇒ Object

Raises:

  • (Errno::ENOENT)


42
43
44
45
# File 'lib/rays/image.rb', line 42

def self.load(path)
  raise Errno::ENOENT, "no such file: '#{path}'" unless File.exist? path
  load! path
end

Instance Method Details

#bitmap(modify = false) ⇒ Object



34
35
36
# File 'lib/rays/image.rb', line 34

def bitmap(modify = false)
  get_bitmap modify
end

#boundsObject



30
31
32
# File 'lib/rays/image.rb', line 30

def bounds()
  Bounds.new 0, 0, width, height
end

#paint(&block) ⇒ Object



21
22
23
24
# File 'lib/rays/image.rb', line 21

def paint(&block)
  painter.paint self, &block
  self
end

#sizeObject



26
27
28
# File 'lib/rays/image.rb', line 26

def size()
  return width, height
end