Class: Abachrome::Gamut::SRGB

Inherits:
Base
  • Object
show all
Defined in:
lib/abachrome/gamut/srgb.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #primaries, #white_point

Instance Method Summary collapse

Methods inherited from Base

#map

Constructor Details

#initializeSRGB

Returns a new instance of SRGB.



28
29
30
31
32
33
34
35
# File 'lib/abachrome/gamut/srgb.rb', line 28

def initialize
  primaries = {
    red: [0.6400, 0.3300],
    green: [0.3000, 0.6000],
    blue: [0.1500, 0.0600]
  }
  super(:srgb, primaries, :D65)
end

Instance Method Details

#contains?(coordinates) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
# File 'lib/abachrome/gamut/srgb.rb', line 37

def contains?(coordinates)
  r, g, b = coordinates
  r.between?(0, 1) &&
    g >= 0 && g <= 1 &&
    b >= 0 && b <= 1
end