Class: Abachrome::Converters::XyzToSrgb
- Defined in:
- lib/abachrome/converters/xyz_to_srgb.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.convert(xyz_color) ⇒ Abachrome::Color
Converts a color from XYZ color space to sRGB 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(xyz_color) ⇒ Abachrome::Color
Converts a color from XYZ color space to sRGB color space.
This method first converts XYZ to linear RGB using the inverse transformation matrix, then applies gamma correction to convert to sRGB. The XYZ color space is the CIE 1931 color space that forms the basis for most other color space definitions and serves as a device-independent reference.
the same alpha as the input color
17 18 19 20 21 22 23 24 25 |
# File 'lib/abachrome/converters/xyz_to_srgb.rb', line 17 def self.convert(xyz_color) raise_unless xyz_color, :xyz # Convert XYZ to linear RGB first lrgb_color = Converters::XyzToLrgb.convert(xyz_color) # Then convert linear RGB to sRGB Converters::LrgbToSrgb.convert(lrgb_color) end |