325: def polygon(points)
326: points = points.map { |pp|
327: pp.kind_of?(Array) ? PDF::Writer::PolygonPoint.new(*pp) : pp
328: }
329:
330: point = points.shift
331:
332: move_to(point.x, point.y)
333:
334: while not points.empty?
335: point = points.shift
336:
337: case point.connector
338: when :curve
339: c1 = point
340: c2 = points.shift
341: point = points.shift
342:
343: curve_to(c1.x, c1.y, c2.x, c2.y, point.x, point.y)
344: when :scurve
345: c1 = point
346: point = points.shift
347: scurve_to(c1.x, c1.y, point.x, point.y)
348: when :ecurve
349: c1 = point
350: point = points.shift
351: ecurve_to(c1.x, c1.y, point.x, point.y)
352: else
353: line_to(point.x, point.y)
354: end
355: end
356:
357: self
358: end