Class: Samscript::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/samscript/image.rb

Class Method Summary collapse

Class Method Details

.get_difference(c1, c2) ⇒ Object



15
16
17
18
19
# File 'lib/samscript/image.rb', line 15

def self.get_difference c1, c2
  [c1.red - c2.red,
   c1.green - c2.green,
   c1.blue - c2.blue].map(&:abs).max
end

.get_pixel(image, params = {}) ⇒ Object



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

def self.get_pixel image, params = {}
  x = params[:x] || 0
  y = params[:y] || 0

  rgb = image.get_rgb(x, y)
  Color.new rgb
end