Method: Processing::Shape#endShape

Defined in:
lib/processing/shape.rb

#endShape(close = nil) ⇒ nil

Ends shape data definition.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/processing/shape.rb', line 94

def endShape(close = nil)
  raise "endShape() must be called after beginShape()" unless drawingShape__
  painter         = @context.getPainter__
  @fill         ||= painter.fill
  @stroke       ||= painter.stroke
  @strokeWeight ||= painter.stroke_width
  @strokeCap    ||= painter.stroke_cap
  @strokeJoin   ||= painter.stroke_join
  @close          = close == GraphicsContext::CLOSE || @contours.size > 0
  if @close && @curvePoints.size >= 8
    x, y = @curvePoints[0, 2]
    2.times {curveVertex x, y}
  end
  @curvePoints = nil
  nil
end