Class: Magick::RVG::PolyShape
- Inherits:
-
Shape
- Object
- Shape
- Magick::RVG::PolyShape
- Defined in:
- lib/rvg/embellishable.rb
Overview
class Rect
Instance Method Summary collapse
Methods included from Duplicatable
Methods included from Transformable
#matrix, #rotate, #scale, #skewX, #skewY, #translate
Methods included from Stylable
Instance Method Details
#polypoints(points) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rvg/embellishable.rb', line 99 def polypoints(points) case points.length when 1 points = Array(points[0]) when 2 x_coords = Array(points[0]) y_coords = Array(points[1]) raise ArgumentError, 'array arguments must contain at least one point' unless !x_coords.empty? && !y_coords.empty? 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 raise ArgumentError, "insufficient/odd number of points specified: #{n}" if n < 4 || n.odd? Magick::RVG.convert_to_float(*points) end |