Class: Colors::XYY

Inherits:
AbstractColor show all
Includes:
Helper
Defined in:
lib/colors/xyy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractColor

#desaturate, #inspect

Constructor Details

#initialize(x, y, large_y) ⇒ XYY

Returns a new instance of XYY.



5
6
7
# File 'lib/colors/xyy.rb', line 5

def initialize(x, y, large_y)
  @x, @y, @large_y = canonicalize(x, y, large_y)
end

Instance Attribute Details

#large_yObject (readonly)

Returns the value of attribute large_y.



9
10
11
# File 'lib/colors/xyy.rb', line 9

def large_y
  @large_y
end

#xObject (readonly)

Returns the value of attribute x.



9
10
11
# File 'lib/colors/xyy.rb', line 9

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



9
10
11
# File 'lib/colors/xyy.rb', line 9

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
18
19
20
21
22
# 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

#componentsObject



11
12
13
# File 'lib/colors/xyy.rb', line 11

def components
  [x, y, large_y]
end

#luv_components(wp) ⇒ Object



32
33
34
# File 'lib/colors/xyy.rb', line 32

def luv_components(wp)
  to_xyz.luv_components(wp)
end

#rgb_componentsObject



28
29
30
# File 'lib/colors/xyy.rb', line 28

def rgb_components
  to_xyz.rgb_components
end

#to_rgbObject



24
25
26
# File 'lib/colors/xyy.rb', line 24

def to_rgb
  to_xyz.to_rgb
end

#to_xyzObject



36
37
38
# File 'lib/colors/xyy.rb', line 36

def to_xyz
  XYZ.new(*Convert.xyy_to_xyz(*components))
end