Class: CTioga2::Graphics::Styles::TwoPointGradient

Inherits:
BasicStyle
  • Object
show all
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

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

Instance Method Summary collapse

Methods included from Log

context, counts, debug, error, fatal, #format_exception, #identify, info, init_logger, log_to, logger, set_level, #spawn, warn

Methods inherited from BasicStyle

alias_for, aliases, attr_accessor, attribute_type, attribute_types, attributes, convert_string_hash, defined_aliases, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, normalize_hash, normalize_in, normalize_out, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other, #use_defaults_from

Constructor Details

#initialize(s, e) ⇒ TwoPointGradient

Returns a new instance of TwoPointGradient.



43
44
45
46
47
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 43

def initialize(s,e)
  warn { "This class shouldn't be used anymore at #{caller.inspect}" }
  @start = s
  @end = e
end

Instance Method Details

#color(x) ⇒ Object

Returns the color for the given value of x (between 0 and 1)



50
51
52
# File 'lib/ctioga2/graphics/styles/gradients.rb', line 50

def color(x)
  return Utils::mix_objects(@end,@start, x)
end