Module: Neri::DXRubyImage

Included in:
DXRuby::Image
Defined in:
lib/neri/dxruby.rb

Instance Method Summary collapse

Instance Method Details

#load(path, x = nil, y = nil, width = nil, height = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/neri/dxruby.rb', line 7

def load(path, x = nil, y = nil, width = nil, height = nil)
  return super unless Neri.exist_in_datafile?(path)

  image = load_from_file_in_memory(Neri.file_read(path))
  image = image.slice(x, y, width, height) if x && y && width && height
  image
end

#load_tiles(path, xcount, ycount, share_switch = true) ⇒ Object



15
16
17
18
19
20
# File 'lib/neri/dxruby.rb', line 15

def load_tiles(path, xcount, ycount, share_switch = true)
  return super unless Neri.exist_in_datafile?(path) && !share_switch

  image = load_from_file_in_memory(Neri.file_read(path))
  image.slice_tiles(xcount, ycount)
end