class Imatcher::Modes::RGB

Compare pixels by values. Resulting image contains per-channel differences.

Public Instance Methods

background(bg) click to toggle source
# File lib/imatcher/modes/rgb.rb, line 17
def background(bg)
  Image.new(bg.width, bg.height, BLACK)
end
create_diff_image(_bg, diff_image) click to toggle source
# File lib/imatcher/modes/rgb.rb, line 21
def create_diff_image(_bg, diff_image)
  diff_image
end
pixels_diff(d, a, b, x, y) click to toggle source
# File lib/imatcher/modes/rgb.rb, line 25
def pixels_diff(d, a, b, x, y)
  d[x, y] = rgb(
    (r(a) - r(b)).abs,
    (g(a) - g(b)).abs,
    (b(a) - b(b)).abs
  )
end
pixels_equal?(a, b) click to toggle source
# File lib/imatcher/modes/rgb.rb, line 8
def pixels_equal?(a, b)
  a == b
end
update_result(a, b, x, y) click to toggle source
Calls superclass method
# File lib/imatcher/modes/rgb.rb, line 12
def update_result(a, b, x, y)
  super
  @result.diff << [a, b, x, y]
end