Class: Colorspace::SRGBLinearColor

Inherits:
Object
  • Object
show all
Defined in:
lib/colorspace/colorlib.rb

Overview

A gamma-expanded (“linear light”) RGB value in the sRGB colorspace.

Instance Method Summary collapse

Instance Method Details

#gamma_compressObject



126
127
128
129
130
131
132
# File 'lib/colorspace/colorlib.rb', line 126

def gamma_compress
  SRGBColor.new(
    r: gamma_compress_one(r),
    g: gamma_compress_one(g),
    b: gamma_compress_one(b)
  )
end

#to_aObject



135
# File 'lib/colorspace/colorlib.rb', line 135

def to_a = to_ary

#to_aryObject



134
# File 'lib/colorspace/colorlib.rb', line 134

def to_ary = [r, g, b]

#to_xyzObject



113
114
115
116
# File 'lib/colorspace/colorlib.rb', line 113

def to_xyz
  x, y, z = (RGB_XYZ_MATRIX * Matrix[[r], [g], [b]]).to_a.flatten
  XYZTristimulus.new(x:, y:, z:)
end