Module: ShapeHelper
- Included in:
- Scarpe::Line, Scarpe::Shape, Scarpe::Star, Scarpe::WebviewArc, Scarpe::WebviewLine, Scarpe::WebviewShape, Scarpe::WebviewStar
- Defined in:
- lib/scarpe/wv/shape_helper.rb
Instance Method Summary collapse
- #color_for_fill ⇒ Object
- #colors ⇒ Object
- #fill(color) ⇒ Object
- #line_to(x, y) ⇒ Object
- #move_to(x, y) ⇒ Object
- #path_commands ⇒ Object
- #shape_path ⇒ Object
Instance Method Details
#color_for_fill ⇒ Object
31 32 33 |
# File 'lib/scarpe/wv/shape_helper.rb', line 31 def color_for_fill $current_color || "black" end |
#colors ⇒ Object
23 24 25 |
# File 'lib/scarpe/wv/shape_helper.rb', line 23 def colors $colors ||= [] end |
#fill(color) ⇒ Object
27 28 29 |
# File 'lib/scarpe/wv/shape_helper.rb', line 27 def fill(color) $current_color = color end |
#line_to(x, y) ⇒ Object
13 14 15 16 |
# File 'lib/scarpe/wv/shape_helper.rb', line 13 def line_to(x, y) validate_coordinates(x, y) path_commands << "L #{x} #{y}" end |
#move_to(x, y) ⇒ Object
8 9 10 11 |
# File 'lib/scarpe/wv/shape_helper.rb', line 8 def move_to(x, y) validate_coordinates(x, y) path_commands << "M #{x} #{y}" end |
#path_commands ⇒ Object
4 5 6 |
# File 'lib/scarpe/wv/shape_helper.rb', line 4 def path_commands $path_commands ||= [] end |
#shape_path ⇒ Object
18 19 20 21 |
# File 'lib/scarpe/wv/shape_helper.rb', line 18 def shape_path path_commands_str = path_commands.join(" ") path_commands_str end |