Class: Wildfire::Converter::ScreenCutter

Inherits:
Core
  • Object
show all
Defined in:
lib/wildfire/converter/screen_cutter.rb

Constant Summary collapse

COORDS =
{
  tl: [30, 47],
  tr: [150, 47],
  bl: [25, 280],
  br: [150, 280],
}.freeze

Constants inherited from Core

Core::RED

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core

#generate_path, #quick_save, #save, #temp_mat

Constructor Details

#initialize(full_path) ⇒ ScreenCutter



13
14
15
16
17
# File 'lib/wildfire/converter/screen_cutter.rb', line 13

def initialize(full_path)
  @full_path = full_path
  @analizer = Analizer.new(full)
  @resizer = Resizer.new(full)
end

Instance Attribute Details

#screen_pathsObject (readonly)

Returns the value of attribute screen_paths.



11
12
13
# File 'lib/wildfire/converter/screen_cutter.rb', line 11

def screen_paths
  @screen_paths
end

Instance Method Details

#cut_screens!Object



27
28
29
30
31
# File 'lib/wildfire/converter/screen_cutter.rb', line 27

def cut_screens!
  @screen_paths = screens.map.with_index do |screen, i|
    save("screen_#{i}.jpg", screen)
  end
end

#screensObject



19
20
21
22
23
24
25
# File 'lib/wildfire/converter/screen_cutter.rb', line 19

def screens
  COORDS.map do |which, coords|
    rect_args = @resizer.to_big_coords([coords + [95, 160]]).flatten
    rect = Cv::Rect.new(*rect_args)
    full.block(rect)
  end
end