Class: Wx::SF::CupArrow
- Defined in:
- lib/wx/shapes/arrows/cup_arrow.rb
Overview
Class extends the Wx::SolidArrow class and encapsulates cup arrow shapes.
Constant Summary collapse
- RADIUS =
Default arc radius size
7
Class Method Summary collapse
Instance Method Summary collapse
- #coords ⇒ Object protected
-
#draw(from, to, dc) ⇒ Wx::Point
Draw arrow shape at the end of a virtual line.
-
#get_radius ⇒ Object
(also: #radius)
Get the circle radius.
-
#initialize(parent = nil) ⇒ CupArrow
constructor
Constructor.
- #scale ⇒ Object protected
Methods inherited from LineArrow
#get_pen, #get_pen_width, #set_parent_shape, #set_pen
Methods inherited from ArrowBase
#get_parent_shape, #set_parent_shape, #translate_arrow
Constructor Details
#initialize(parent = nil) ⇒ CupArrow
Constructor
25 26 27 28 |
# File 'lib/wx/shapes/arrows/cup_arrow.rb', line 25 def initialize(parent=nil) super scale end |
Class Method Details
Instance Method Details
#coords ⇒ Object (protected)
36 37 38 |
# File 'lib/wx/shapes/arrows/cup_arrow.rb', line 36 def coords @coords ||= CupArrow.arrow(get_radius) end |
#draw(from, to, dc) ⇒ Wx::Point
Draw arrow shape at the end of a virtual line.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/wx/shapes/arrows/cup_arrow.rb', line 52 def draw(from, to, dc) rarrow = translate_arrow(coords, from, to) cp = rarrow.pop dc.with_pen(pen) do |dc| dc.with_brush(Wx::TRANSPARENT_BRUSH) do |dc| dc.draw_arc(*rarrow) end end cp end |
#get_radius ⇒ Object Also known as: radius
Get the circle radius
31 32 33 |
# File 'lib/wx/shapes/arrows/cup_arrow.rb', line 31 def get_radius (RADIUS * @ratio).to_i end |
#scale ⇒ Object (protected)
41 42 43 44 |
# File 'lib/wx/shapes/arrows/cup_arrow.rb', line 41 def scale @coords = nil @ratio = 1 + (pen_width / 2) * 0.5 end |