class Rocrad::Mixed
Attributes
areas[RW]
Public Class Methods
new(src="", options = {}) { |self| ... }
click to toggle source
Calls superclass method
Rocrad::new
# File lib/rocrad/mixed.rb, line 6 def initialize(src="", options = {}) super(src) @areas = options.delete(:areas) || [] yield self if block_given? end
Public Instance Methods
add_area(x, y, w, h)
click to toggle source
# File lib/rocrad/mixed.rb, line 12 def add_area(x, y, w, h) @txt = "" @areas << {:x => x, :y => y, :w => w, :h => h} end
areas=(value)
click to toggle source
# File lib/rocrad/mixed.rb, line 17 def areas=(value) @areas = value.instance_of?(Array) ? value : [] @areas.delete_if { |area| !area.is_a?(Hash) or !area.has_key?(:x) or !area.has_key?(:y) or !area.has_key?(:w) or !area.has_key?(:h) } @txt = "" end
Private Instance Methods
ocr!()
click to toggle source
Convert parts of image to string
# File lib/rocrad/mixed.rb, line 27 def ocr! @txt = "" @areas.each do |area| image = Rocrad.new(@src.to_s) image.crop!(area[:x].to_i, area[:y].to_i, area[:w].to_i, area[:h].to_i) @txt << image.to_s end @txt end