Module: Salamander::Drawing::Line
- Included in:
- Shapes
- Defined in:
- lib/salamander/drawing/line.rb
Instance Method Summary collapse
-
#line(distance, direction = nil) ⇒ Object
Draws a line ‘distance’ pixels long from the current position in the current drawing color.
-
#line_to(x2, y2) ⇒ Object
Draws a line from the current position to (x2, y2) in the current drawing color.
Instance Method Details
#line(distance, direction = nil) ⇒ Object
Draws a line ‘distance’ pixels long from the current position in the current drawing color.
11 12 13 14 15 16 |
# 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) ⇒ Object
Draws a line from the current position to (x2, y2) in the current drawing color.
4 5 6 7 8 |
# 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 |