class Fox::Canvas::LineShape

Attributes

lineCap[RW]
lineJoin[RW]
lineStyle[RW]
lineWidth[RW]
x1[RW]
x2[RW]
y1[RW]
y2[RW]

Public Class Methods

new(x1, y1, x2, y2) click to toggle source
Calls superclass method Fox::Canvas::Shape.new
# File lib/fox16/canvas.rb, line 176
def initialize(x1, y1, x2, y2)
  super(x1, y1)
  @x1, @y1, @x2, @y2 = x1, y1, x2, y2
  @lineWidth = 1
  @lineCap = CAP_NOT_LAST
  @lineJoin = JOIN_MITER
  @lineStyle = LINE_SOLID
end

Public Instance Methods

draw(dc) click to toggle source
# File lib/fox16/canvas.rb, line 193
def draw(dc)
  # Save old values
  oldForeground = dc.foreground
  oldLineWidth = dc.lineWidth
  oldLineCap = dc.lineCap
  oldLineJoin = dc.lineJoin
  oldLineStyle = dc.lineStyle

  # Set properties for this line
  dc.foreground = foreground
  dc.lineWidth = lineWidth
  dc.lineCap = lineCap
  dc.lineJoin = lineJoin
  dc.lineStyle = lineStyle

  # Draw the line
  dc.drawLine(x1, y1, x2, y2)

  # Restore old properties
  dc.lineWidth = oldLineWidth
  dc.lineCap = oldLineCap
  dc.lineJoin = oldLineJoin
  dc.lineStyle = oldLineStyle
  dc.foreground = oldForeground
end
height() click to toggle source
# File lib/fox16/canvas.rb, line 189
def height
  0
end
width() click to toggle source
# File lib/fox16/canvas.rb, line 185
def width
  0
end