Class: Abachrome::Converters::LmsToSrgb

Inherits:
Base
  • Object
show all
Defined in:
lib/abachrome/converters/lms_to_srgb.rb

Instance Attribute Summary

Attributes inherited from Base

#from_space, #to_space

Class Method Summary collapse

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(lms_color) ⇒ Abachrome::Color

Converts a color from LMS color space to sRGB color space.

This method implements a two-step conversion process:

  1. First converts from LMS to linear RGB using the standard transformation matrix

  2. Then converts from linear RGB to sRGB by applying gamma correction

the same alpha as the input color

Raises:

  • (ArgumentError)

    If the input color is not in LMS color space



14
15
16
17
18
19
20
# File 'lib/abachrome/converters/lms_to_srgb.rb', line 14

def self.convert(lms_color)
  # First convert LMS to linear RGB
  lrgb_color = LmsToLrgb.convert(lms_color)
  
  # Then convert linear RGB to sRGB
  LrgbToSrgb.convert(lrgb_color)
end