Class: Abachrome::Gamut::Base
- Inherits:
-
Object
- Object
- Abachrome::Gamut::Base
- Defined in:
- lib/abachrome/gamut/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primaries ⇒ Object
readonly
Returns the value of attribute primaries.
-
#white_point ⇒ Object
readonly
Returns the value of attribute white_point.
Instance Method Summary collapse
-
#contains?(coordinates) ⇒ Boolean
TODO: - make this work properly.
-
#initialize(name, primaries, white_point) ⇒ Base
constructor
A new instance of Base.
- #map(coordinates, method: :clip) ⇒ Object
Constructor Details
#initialize(name, primaries, white_point) ⇒ Base
Returns a new instance of Base.
22 23 24 25 26 |
# File 'lib/abachrome/gamut/base.rb', line 22 def initialize(name, primaries, white_point) @name = name @primaries = primaries @white_point = white_point end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/abachrome/gamut/base.rb', line 20 def name @name end |
#primaries ⇒ Object (readonly)
Returns the value of attribute primaries.
20 21 22 |
# File 'lib/abachrome/gamut/base.rb', line 20 def primaries @primaries end |
#white_point ⇒ Object (readonly)
Returns the value of attribute white_point.
20 21 22 |
# File 'lib/abachrome/gamut/base.rb', line 20 def white_point @white_point end |
Instance Method Details
#contains?(coordinates) ⇒ Boolean
TODO: - make this work properly
29 30 31 32 33 34 |
# File 'lib/abachrome/gamut/base.rb', line 29 def contains?(coordinates) x, y, z = coordinates x >= 0 && x <= 1 && y >= 0 && y <= 1 && z >= 0 && z <= 1 end |
#map(coordinates, method: :clip) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/abachrome/gamut/base.rb', line 36 def map(coordinates, method: :clip) case method when :clip clip(coordinates) when :scale scale(coordinates) else raise ArgumentError, "Unknown mapping method: #{method}" end end |