Module: ShapeHelper

Instance Method Summary collapse

Instance Method Details

#color_for_fillObject



31
32
33
# File 'lib/scarpe/wv/shape_helper.rb', line 31

def color_for_fill
  $current_color || "black"
end

#colorsObject



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_commandsObject



4
5
6
# File 'lib/scarpe/wv/shape_helper.rb', line 4

def path_commands
  $path_commands ||= []
end

#shape_pathObject



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