Class: CTioga2::Graphics::Elements::GradientRegion
- Inherits:
-
RedirectingContainer
- Object
- TiogaElement
- Container
- RedirectingContainer
- CTioga2::Graphics::Elements::GradientRegion
- Defined in:
- lib/ctioga2/graphics/elements/gradient-region.rb
Overview
A GradientRegion is an object that makes color gradient for the curves. Especially useful for a great number of curves, and when one doesn’t want to compute…
Like Region It is a fake container in the sense that all the elements are actually forwarded to the parent.
Instance Attribute Summary collapse
-
#curves ⇒ Object
The curves which delimit the region.
-
#end_color ⇒ Object
The start and end colors.
-
#start_color ⇒ Object
The start and end colors.
Attributes inherited from Container
#elements, #legend_area, #legend_storage, #root_object, #subframe
Attributes inherited from TiogaElement
Instance Method Summary collapse
-
#add_element(element) ⇒ Object
Adds an element.
-
#initialize(parent = nil, root = nil) ⇒ GradientRegion
constructor
Creates a new empty region.
-
#set_from_hash(hash) ⇒ Object
Sets the various things from hash.
Methods inherited from RedirectingContainer
#add_legend_item, #legend_area=, #style
Methods inherited from Container
#actual_subframe, #add_legend_item, #size
Methods inherited from TiogaElement
Methods included from Log
debug, error, fatal, #format_exception, #identify, info, init_logger, logger, set_level, #spawn, warn
Constructor Details
#initialize(parent = nil, root = nil) ⇒ GradientRegion
Creates a new empty region
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 46 def initialize(parent = nil, root = nil) @parent = parent # The curves whose color we should change @curves = [] @root_object = root @legend_area = nil @start_color = Tioga::ColorConstants::Red @end_color = Tioga::ColorConstants::Green end |
Instance Attribute Details
#curves ⇒ Object
The curves which delimit the region
40 41 42 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 40 def curves @curves end |
#end_color ⇒ Object
The start and end colors
43 44 45 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 43 def end_color @end_color end |
#start_color ⇒ Object
The start and end colors
43 44 45 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 43 def start_color @start_color end |
Instance Method Details
#add_element(element) ⇒ Object
Adds an element. Actually forwards it to the parent.
62 63 64 65 66 67 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 62 def add_element(element) parent.add_element(element) if element.respond_to?(:curve_style) @curves << element end end |
#set_from_hash(hash) ⇒ Object
Sets the various things from hash.
70 71 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 70 def set_from_hash(hash) end |