Object
Represents color in the HSV (Hue, Saturation, Value) color space.
Create a new instance from an Array or an existing color (of any type). If the alpha (opacity) component is omitted from the array, full opacity will be used.
All color components range from 0.0 to 1.0.
# File lib/rubygame/color/models/hsv.rb, line 42 def initialize( color ) if color.kind_of?(Array) @h, @s, @v, @a = color.collect { |i| i.to_f } @a = 1.0 unless @a elsif color.respond_to?(:to_rgba_ary) @h, @s, @v, @a = self.class.rgba_to_hsva( *color.to_rgba_ary ) end end
Return an Array with the red, green, blue, and alpha components of the color (converting the color to the RGBA model first).
# File lib/rubygame/color/models/hsv.rb, line 53 def to_rgba_ary return self.class.hsva_to_rgba( @h, @s, @v, @a ) end
# File lib/rubygame/color/models/hsv.rb, line 57 def to_s "#<#{self.class} [#{@h}, #{@s}, #{@v}, #{@a}]>" end
Generated with the Darkfish Rdoc Generator 2.