Class Magick::RVG::PolyShape
In: lib/rvg/embellishable.rb
Parent: Shape
Enum GeometryValue Stylable RVG\n[lib/rvg/clippath.rb\nlib/rvg/container.rb\nlib/rvg/deep_equal.rb\nlib/rvg/describable.rb\nlib/rvg/embellishable.rb\nlib/rvg/misc.rb\nlib/rvg/paint.rb\nlib/rvg/pathdata.rb\nlib/rvg/rvg.rb\nlib/rvg/stretchable.rb\nlib/rvg/stylable.rb\nlib/rvg/text.rb\nlib/rvg/transformable.rb\nlib/rvg/units.rb] Transformable Stretchable Embellishable Describable Duplicatable Comparable Image ImageList Array Geometry HatchFill Draw lib/RMagick.rb lib/rvg/units.rb Magick Module: Magick

Methods

Public Instance methods

[Source]

     # File lib/rvg/embellishable.rb, line 116
116:         def polypoints(points)
117:             case points.length
118:                 when 1
119:                     points = Array(points[0])
120:                 when 2
121:                     x_coords = Array(points[0])
122:                     y_coords = Array(points[1])
123:                     unless x_coords.length > 0 && y_coords.length > 0
124:                         raise ArgumentError, "array arguments must contain at least one point"
125:                     end
126:                     n = x_coords.length - y_coords.length
127:                     short = n > 0 ? y_coords : x_coords
128:                     olen = short.length
129:                     n.abs.times {|x| short << short[x % olen]}
130:                     points = x_coords.zip(y_coords).flatten
131:             end
132:             n = points.length
133:             if n < 4 || n % 2 != 0
134:                 raise ArgumentError, "insufficient/odd number of points specified: #{n}"
135:             end
136:             return Magick::RVG.convert_to_float(*points)
137:         end

[Validate]