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.
Constant Summary
Constants inherited from TiogaElement
TiogaElement::StyleBaseOptions
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, #gp_cache, #legend_area, #legend_item_target, #legend_storage, #root_object, #subframe
Attributes inherited from TiogaElement
#clipped, #depth, #hidden, #location, #object_classes, #object_id, #object_parent, #parent
Instance Method Summary collapse
-
#add_element(element) ⇒ Object
Adds an element.
-
#initialize(parent, root, options) ⇒ GradientRegion
constructor
Creates a new empty region.
-
#set_from_hash(hash) ⇒ Object
Sets the various things from hash.
Methods inherited from RedirectingContainer
Methods inherited from Container
#actual_subframe, #add_legend_item, #do, #each_item, #enter_legend_subcontainer, #size
Methods inherited from TiogaElement
all_styles, base_style, #check_styled, define_style, #do, find_object, find_objects, #get_style, #has_style?, inherited, #inspect, register_object, register_style, #setup_style, #style_class, style_class, style_name, #style_name, styled_classes, #update_style
Methods included from Log
context, counts, debug, error, fatal, #format_exception, #identify, info, init_logger, log_to, logger, set_level, #spawn, warn
Constructor Details
#initialize(parent, root, options) ⇒ GradientRegion
Creates a new empty region
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 46 def initialize(parent, root, ) @parent = parent setup_style(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.
63 64 65 66 67 68 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 63 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.
71 72 |
# File 'lib/ctioga2/graphics/elements/gradient-region.rb', line 71 def set_from_hash(hash) end |