Sha256: 8f9ad98f9bb4e6b6d3ba5061706d176473a372fce665043a5bfe51723a1f2732

Contents?: true

Size: 636 Bytes

Versions: 13

Compression:

Stored size: 636 Bytes

Contents

require "#{File.dirname(__FILE__)}/../example_helper.rb"

def radian(degree)
  Math::PI/180*degree
end

def point_on_circle(center, radius, degrees)
  [center[0] + radius*(Math.cos(radian(degrees))), center[1] - radius*(Math.sin(radian(degrees)))]
end

pdf = Prawn::Document.new

pentagon_points = (0..4).map{|i| point_on_circle([200, 400], 100, i * 72)}
pentagram_points = [0, 2, 4, 1, 3].map{|i| pentagon_points[i]}
pdf.stroke_rounded_polygon(20, *pentagram_points)
pdf.fill_and_stroke_rounded_polygon(10, [100, 250], [200, 300], [300, 250],
                 [300, 150], [200, 100], [100, 150])

pdf.render_file "rounded_polygon.pdf"

Version data entries

13 entries across 13 versions & 6 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/graphics/rounded_polygons.rb
piglop-prawn-0.10.2.2 examples/graphics/rounded_polygons.rb
piglop-prawn-0.10.2.1 examples/graphics/rounded_polygons.rb
prawn-0.11.1.pre examples/graphics/rounded_polygons.rb
goodwill-prawn-edge-0.10.0 examples/graphics/rounded_polygons.rb
alphasights-prawn-0.10.4 examples/graphics/rounded_polygons.rb
alphasights-prawn-0.10.3 examples/graphics/rounded_polygons.rb
alphasights-prawn-0.10.2 examples/graphics/rounded_polygons.rb
alphasights-prawn-0.10.1 examples/graphics/rounded_polygons.rb
alphasights-prawn-0.10.0 examples/graphics/rounded_polygons.rb
prawn-core-0.8.4 examples/graphics/rounded_polygons.rb
prawn-graph-0.0.2 vendor/prawn-core/examples/graphics/rounded_polygons.rb
prawn-graph-0.0.1 vendor/prawn-core/examples/graphics/rounded_polygons.rb