Class: Chroma::ColorModes::Hsv

Inherits:
Object
  • Object
show all
Defined in:
lib/chroma/color_modes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h, s, v, a = 1) ⇒ Hsv

Returns a new instance of Hsv

Parameters:

  • h (Numeric)
  • s (Numeric)
  • v (Numeric)
  • a (Numeric) (defaults to: 1)

8
9
10
# File 'lib/chroma/color_modes.rb', line 8

def initialize(h, s, v, a = 1)
  @h, @s, @v, @a = h, s, v, a
end

Instance Attribute Details

#aObject

Returns the value of attribute a


2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def a
  @a
end

#hObject

Returns the value of attribute h


2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def h
  @h
end

#sObject

Returns the value of attribute s


2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def s
  @s
end

#vObject

Returns the value of attribute v


2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def v
  @v
end

Instance Method Details

#to_aArray<Numeric> Also known as: to_ary

Returns the values h, s, v, and a as an array.

Returns:

  • (Array<Numeric>)

15
16
17
# File 'lib/chroma/color_modes.rb', line 15

def to_a
  [@h, @s, @v, @a]
end