Class: Abachrome::Converters::CmykToSrgb

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

Class Method Summary collapse

Class Method Details

.convert(cmyk_color) ⇒ Abachrome::Color

Converts a color from CMYK color space to sRGB color space. This method applies the standard CMYK to RGB transformation.

with the same alpha value as the input color

Parameters:

Returns:



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/abachrome/converters/cmyk_to_srgb.rb', line 28

def self.convert(cmyk_color)
  c, m, y, k = cmyk_color.coordinates.map { |component| AbcDecimal(component) }

  # Use the CMYK color model's conversion method
  r, g, b = ColorModels::CMYK.to_rgb(c, m, y, k)

  Color.new(
    ColorSpace.find(:srgb),
    [r, g, b],
    cmyk_color.alpha
  )
end