Class: Fox::Canvas::LineShape
Instance Attribute Summary collapse
-
#lineCap ⇒ Object
Returns the value of attribute lineCap.
-
#lineJoin ⇒ Object
Returns the value of attribute lineJoin.
-
#lineStyle ⇒ Object
Returns the value of attribute lineStyle.
-
#lineWidth ⇒ Object
Returns the value of attribute lineWidth.
-
#x1 ⇒ Object
Returns the value of attribute x1.
-
#x2 ⇒ Object
Returns the value of attribute x2.
-
#y1 ⇒ Object
Returns the value of attribute y1.
-
#y2 ⇒ Object
Returns the value of attribute y2.
Attributes inherited from Shape
#foreground, #selector, #target, #x, #y
Instance Method Summary collapse
- #draw(dc) ⇒ Object
- #height ⇒ Object
-
#initialize(x1, y1, x2, y2) ⇒ LineShape
constructor
A new instance of LineShape.
- #width ⇒ Object
Methods inherited from Shape
#apply_dc, #bounds, #deselect, #disable, #draggable=, #draggable?, #drawOutline, #enable, #enabled?, #hide, #hit?, #makeControlPoints, #move, #position, #resize, #select, #selected?, #show, #visible?
Constructor Details
#initialize(x1, y1, x2, y2) ⇒ LineShape
Returns a new instance of LineShape.
183 184 185 186 187 188 189 190 |
# File 'lib/fox16/canvas.rb', line 183 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 |
Instance Attribute Details
#lineCap ⇒ Object
Returns the value of attribute lineCap.
180 181 182 |
# File 'lib/fox16/canvas.rb', line 180 def lineCap @lineCap end |
#lineJoin ⇒ Object
Returns the value of attribute lineJoin.
180 181 182 |
# File 'lib/fox16/canvas.rb', line 180 def lineJoin @lineJoin end |
#lineStyle ⇒ Object
Returns the value of attribute lineStyle.
180 181 182 |
# File 'lib/fox16/canvas.rb', line 180 def lineStyle @lineStyle end |
#lineWidth ⇒ Object
Returns the value of attribute lineWidth.
180 181 182 |
# File 'lib/fox16/canvas.rb', line 180 def lineWidth @lineWidth end |
#x1 ⇒ Object
Returns the value of attribute x1.
181 182 183 |
# File 'lib/fox16/canvas.rb', line 181 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
181 182 183 |
# File 'lib/fox16/canvas.rb', line 181 def x2 @x2 end |
#y1 ⇒ Object
Returns the value of attribute y1.
181 182 183 |
# File 'lib/fox16/canvas.rb', line 181 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
181 182 183 |
# File 'lib/fox16/canvas.rb', line 181 def y2 @y2 end |
Instance Method Details
#draw(dc) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/fox16/canvas.rb', line 200 def draw(dc) apply_dc(dc) do # Save old values oldLineWidth = dc.lineWidth oldLineCap = dc.lineCap oldLineJoin = dc.lineJoin oldLineStyle = dc.lineStyle # Set properties for this line 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 end end |
#height ⇒ Object
196 197 198 |
# File 'lib/fox16/canvas.rb', line 196 def height 0 end |
#width ⇒ Object
192 193 194 |
# File 'lib/fox16/canvas.rb', line 192 def width 0 end |