class Magick::RVG::PolyShape
Public Instance Methods
polypoints(points)
click to toggle source
# File lib/rvg/embellishable.rb, line 103 def polypoints(points) case points.length when 1 points = Array(points[0]) when 2 x_coords = Array(points[0]) y_coords = Array(points[1]) unless x_coords.length > 0 && y_coords.length > 0 fail ArgumentError, 'array arguments must contain at least one point' end n = x_coords.length - y_coords.length short = n > 0 ? y_coords : x_coords olen = short.length n.abs.times {|x| short << short[x % olen]} points = x_coords.zip(y_coords).flatten end n = points.length if n < 4 || n.odd? fail ArgumentError, "insufficient/odd number of points specified: #{n}" end Magick::RVG.convert_to_float(*points) end