Class: Abachrome::Converters::SrgbToLms
- Defined in:
- lib/abachrome/converters/srgb_to_lms.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.convert(srgb_color) ⇒ Abachrome::Color
Converts a color from sRGB color space to LMS color space.
Methods inherited from Base
#can_convert?, #convert, find_converter, #initialize, raise_unless, register
Constructor Details
This class inherits a constructor from Abachrome::Converters::Base
Class Method Details
.convert(srgb_color) ⇒ Abachrome::Color
Converts a color from sRGB color space to LMS color space.
This method converts sRGB to linear RGB first, then to LMS cone response space. The LMS color space represents the response of the three types of cone cells in the human eye (Long, Medium, Short wavelength sensitivity).
the same alpha as the input color
16 17 18 19 20 21 22 23 24 |
# File 'lib/abachrome/converters/srgb_to_lms.rb', line 16 def self.convert(srgb_color) raise_unless srgb_color, :srgb # Convert sRGB to linear RGB first lrgb_color = Converters::SrgbToLrgb.convert(srgb_color) # Then convert linear RGB to LMS Converters::LrgbToLms.convert(lrgb_color) end |