Class: Percept::Pixel

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
PixelUtils, Utils
Defined in:
lib/percept/pixel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PixelUtils

#background_color, #blackish?, #color_tolerance, #deselect!, #foreground_color, #scaled_blue, #scaled_blue=, #scaled_colors, #scaled_green, #scaled_green=, #scaled_red, #scaled_red=, #select!, #selected?, #symbol, #to_s

Methods included from Utils

#color_tolerance, #scaled_color

Constructor Details

#initialize(values, selected: false) ⇒ Pixel

Returns a new instance of Pixel.



11
12
13
14
15
16
# File 'lib/percept/pixel.rb', line 11

def initialize(values, selected: false)
  self.red = values.fetch(:red)
  self.green = values.fetch(:green)
  self.blue = values.fetch(:blue)
  self.selected = selected == true
end

Instance Attribute Details

#blueObject

Returns the value of attribute blue.



9
10
11
# File 'lib/percept/pixel.rb', line 9

def blue
  @blue
end

#greenObject

Returns the value of attribute green.



9
10
11
# File 'lib/percept/pixel.rb', line 9

def green
  @green
end

#redObject

Returns the value of attribute red.



9
10
11
# File 'lib/percept/pixel.rb', line 9

def red
  @red
end

#selectedObject

Returns the value of attribute selected.



9
10
11
# File 'lib/percept/pixel.rb', line 9

def selected
  @selected
end

Instance Method Details

#scale_down(color_value) ⇒ Object



18
19
20
# File 'lib/percept/pixel.rb', line 18

def scale_down(color_value)
  color_value
end

#scale_up(color_value) ⇒ Object



22
23
24
# File 'lib/percept/pixel.rb', line 22

def scale_up(color_value)
  color_value
end