Sha256: a727233d2fd535fccf1156599bb947c323b995507521f285028518242530b266
Contents?: true
Size: 791 Bytes
Versions: 4
Compression:
Stored size: 791 Bytes
Contents
module Colors class XYY < AbstractColor include Helper def initialize(x, y, large_y) @x, @y, @large_y = canonicalize(x, y, large_y) end attr_reader :x, :y, :large_y def components [x, y, large_y] end def ==(other) case other when XYY x == other.x && y == other.y && large_y == other.large_y else super end end def to_rgb to_xyz.to_rgb end def rgb_components to_xyz.rgb_components end def luv_components(wp) to_xyz.luv_components(wp) end def to_xyz XYZ.new(*Convert.xyy_to_xyz(*components)) end private def canonicalize(x, y, large_y) [ Rational(x), Rational(y), Rational(large_y) ] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
red-colors-0.4.0 | lib/colors/xyy.rb |
red-colors-0.3.0 | lib/colors/xyy.rb |
red-colors-0.2.0 | lib/colors/xyy.rb |
red-colors-0.1.3 | lib/colors/xyy.rb |