lib/chroma/converters/hsv_converter.rb in chroma-0.0.1.alpha.2 vs lib/chroma/converters/hsv_converter.rb in chroma-0.0.1.alpha.3
- old
+ new
@@ -1,8 +1,11 @@
module Chroma
module Converters
+ # Class to convert a color mode to {ColorModes::Hsl}.
class HsvConverter < Base
+ # Convert rgb to hsv.
+ # @return [ColorModes::Hsv]
def convert_rgb
r = bound01(@input.r, 255)
g = bound01(@input.g, 255)
b = bound01(@input.b, 255)
@@ -27,13 +30,17 @@
end
ColorModes::Hsv.new(h * 360, s, v, @input.a)
end
+ # Convert hsl to hsv.
+ # @return [ColorModes::Hsv]
def convert_hsl
HslConverter.convert_rgb(RgbConverter.convert_hsv(@input))
end
+ # Returns @input because it's the same color mode.
+ # @return [ColorModes::Hsv]
def convert_hsv
@input
end
end
end