Method: Color::YIQ#==

Defined in:
lib/extensions/pdf-writer/color/yiq.rb

#==(other) ⇒ Object

Compares the other colour to this one. The other colour will be converted to YIQ before comparison, so the comparison between a YIQ colour and a non-YIQ colour will be approximate and based on the other colour’s #to_yiq conversion. If there is no #to_yiq conversion, this will raise an exception. This will report that two YIQ values are equivalent if all component colours are within COLOR_TOLERANCE of each other.



42
43
44
45
46
47
48
# File 'lib/extensions/pdf-writer/color/yiq.rb', line 42

def ==(other)
  other = other.to_yiq
  other.kind_of?(Color::YIQ) and
  ((@y - other.y).abs <= Color::COLOR_TOLERANCE) and
  ((@i - other.i).abs <= Color::COLOR_TOLERANCE) and
  ((@q - other.q).abs <= Color::COLOR_TOLERANCE) 
end