Module: Shoes::Swt::Common::Stroke
- Defined in:
- shoes-swt/lib/shoes/swt/common/stroke.rb
Overview
Note:
Including classes must provide ‘#dsl`
Methods for retrieving stroke values from a Shoes DSL class
Instance Method Summary collapse
- #apply_stroke(context) ⇒ Object
-
#stroke ⇒ Swt::Graphics::Color
This object’s stroke color.
-
#stroke_alpha ⇒ Integer
This object’s stroke alpha value.
-
#strokewidth ⇒ Integer
This object’s strokewidth.
-
#update_stroke ⇒ Object
Just clear it out and let next paint recreate and save our SWT color.
Instance Method Details
#apply_stroke(context) ⇒ Object
39 40 41 42 43 44 45 |
# File 'shoes-swt/lib/shoes/swt/common/stroke.rb', line 39 def apply_stroke(context) return unless stroke stroke.apply_as_stroke(context, self) context.set_line_width strokewidth true end |
#stroke ⇒ Swt::Graphics::Color
This object’s stroke color
13 14 15 16 17 18 |
# File 'shoes-swt/lib/shoes/swt/common/stroke.rb', line 13 def stroke return @cached_swt_stroke if @cached_swt_stroke @color_factory ||= ::Shoes::Swt::ColorFactory.new @cached_swt_stroke = @color_factory.create(dsl.stroke) end |
#stroke_alpha ⇒ Integer
This object’s stroke alpha value
23 24 25 |
# File 'shoes-swt/lib/shoes/swt/common/stroke.rb', line 23 def stroke_alpha dsl&.stroke&.alpha end |
#strokewidth ⇒ Integer
This object’s strokewidth
30 31 32 |
# File 'shoes-swt/lib/shoes/swt/common/stroke.rb', line 30 def strokewidth dsl.strokewidth end |
#update_stroke ⇒ Object
Just clear it out and let next paint recreate and save our SWT color
35 36 37 |
# File 'shoes-swt/lib/shoes/swt/common/stroke.rb', line 35 def update_stroke @cached_swt_stroke = nil end |