Class: Percept::Pixel
- Inherits:
-
Object
- Object
- Percept::Pixel
- Extended by:
- Forwardable
- Includes:
- PixelUtils, Utils
- Defined in:
- lib/percept/pixel.rb
Instance Attribute Summary collapse
-
#blue ⇒ Object
Returns the value of attribute blue.
-
#green ⇒ Object
Returns the value of attribute green.
-
#red ⇒ Object
Returns the value of attribute red.
-
#selected ⇒ Object
Returns the value of attribute selected.
Instance Method Summary collapse
-
#initialize(values, selected: false) ⇒ Pixel
constructor
A new instance of Pixel.
- #scale_down(color_value) ⇒ Object
- #scale_up(color_value) ⇒ Object
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
#blue ⇒ Object
Returns the value of attribute blue.
9 10 11 |
# File 'lib/percept/pixel.rb', line 9 def blue @blue end |
#green ⇒ Object
Returns the value of attribute green.
9 10 11 |
# File 'lib/percept/pixel.rb', line 9 def green @green end |
#red ⇒ Object
Returns the value of attribute red.
9 10 11 |
# File 'lib/percept/pixel.rb', line 9 def red @red end |
#selected ⇒ Object
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 |