module Salamander::Drawing::Line

Public Instance Methods

line(distance, direction=nil) click to toggle source

Draws a line ‘distance’ pixels long from the current position in the current drawing color.

# File lib/salamander/drawing/line.rb, line 11
def line (distance, direction=nil)
  x1, y1 = position
  move distance, direction
  x2, y2 = position
  canvas.line(x1, y1, x2, y2, color)
end
line_to(x2, y2) click to toggle source

Draws a line from the current position to (x2, y2) in the current drawing color.

# File lib/salamander/drawing/line.rb, line 4
def line_to (x2, y2)
  x1, y1 = position
  move_to(x2, y2)
  canvas.line(x1, y1, x2, y2, color)
end