Class: CTioga2::Graphics::Styles::TwoPointGradient
- Inherits:
-
BasicStyle
- Object
- BasicStyle
- CTioga2::Graphics::Styles::TwoPointGradient
- Includes:
- Log
- Defined in:
- lib/ctioga2/graphics/styles/gradients.rb
Overview
TODO:
This will have to be replaced by a real color map based
A color gradient with two points
todo There could be many more
on what
Constant Summary
Constants inherited from BasicStyle
Instance Attribute Summary collapse
-
#end ⇒ Object
The ending color (for x = 1).
-
#start ⇒ Object
The starting color (for x = 0).
Instance Method Summary collapse
-
#color(x) ⇒ Object
Returns the color for the given value of x (between 0 and 1).
-
#initialize(s, e) ⇒ TwoPointGradient
constructor
A new instance of TwoPointGradient.
Methods included from Log
debug, error, fatal, #format_exception, #identify, info, init_logger, logger, set_level, #spawn, warn
Methods inherited from BasicStyle
attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other
Constructor Details
#initialize(s, e) ⇒ TwoPointGradient
Returns a new instance of TwoPointGradient.
45 46 47 48 49 |
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 45 def initialize(s,e) warn { "This class shouldn't be used anymore at #{caller.inspect}" } @start = s @end = e end |
Instance Attribute Details
#end ⇒ Object
The ending color (for x = 1)
43 44 45 |
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 43 def end @end end |
#start ⇒ Object
The starting color (for x = 0)
40 41 42 |
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 40 def start @start end |
Instance Method Details
#color(x) ⇒ Object
Returns the color for the given value of x (between 0 and 1)
52 53 54 |
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 52 def color(x) return Utils::mix_objects(@end,@start, x) end |