class Colors::XYY

Attributes

large_y[R]
x[R]
y[R]

Public Class Methods

new(x, y, large_y) click to toggle source
# File lib/colors/xyy.rb, line 5
def initialize(x, y, large_y)
  @x, @y, @large_y = canonicalize(x, y, large_y)
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/colors/xyy.rb, line 15
def ==(other)
  case other
  when XYY
    x == other.x && y == other.y && large_y == other.large_y
  else
    super
  end
end
components() click to toggle source
# File lib/colors/xyy.rb, line 11
def components
  [x, y, large_y]
end
luv_components(wp) click to toggle source
# File lib/colors/xyy.rb, line 32
def luv_components(wp)
  to_xyz.luv_components(wp)
end
rgb_components() click to toggle source
# File lib/colors/xyy.rb, line 28
def rgb_components
  to_xyz.rgb_components
end
to_rgb() click to toggle source
# File lib/colors/xyy.rb, line 24
def to_rgb
  to_xyz.to_rgb
end
to_xyz() click to toggle source
# File lib/colors/xyy.rb, line 36
def to_xyz
  large_x = large_y*x/y
  large_z = large_y*(1 - x - y)/y
  XYZ.new(large_x, large_y, large_z)
end

Private Instance Methods

canonicalize(x, y, large_y) click to toggle source
# File lib/colors/xyy.rb, line 42
        def canonicalize(x, y, large_y)
  [
    Rational(x),
    Rational(y),
    Rational(large_y)
  ]
end