Class: Abachrome::Converters::OklabToXyz

Inherits:
Base
  • Object
show all
Defined in:
lib/abachrome/converters/oklab_to_xyz.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(oklab_color) ⇒ Abachrome::Color

Converts a color from OKLAB color space to XYZ color space.

This method converts OKLAB to LMS first, then to XYZ. The OKLAB color space is a perceptually uniform color space, and XYZ is the CIE 1931 color space that forms the basis for most other color space definitions.

the same alpha as the input color

Parameters:

Returns:

Raises:

  • (ArgumentError)

    If the input color is not in OKLAB color space



16
17
18
19
20
21
22
23
24
# File 'lib/abachrome/converters/oklab_to_xyz.rb', line 16

def self.convert(oklab_color)
  raise_unless oklab_color, :oklab

  # Convert OKLAB to LMS first
  lms_color = Converters::OklabToLms.convert(oklab_color)

  # Then convert LMS to XYZ
  Converters::LmsToXyz.convert(lms_color)
end