Shapes library for Prawn

Available thus far:

  • star

  • half_star

  • arc

  • pie_slice

  • half_circle

  • quarter_circle

Usage

Install the prawn_shapes gem, then:

require 'prawn_shapes'

And:

pdf.star([x, y], :radius => r)

pdf.arc_around([x, y], :radius => r, :start_angle => 30, :end_angle => 60)
pdf.pie_slice([x, y], :radius => r, :start_angle => 45, :end_angle => 135)
pdf.half_circle([x, y], :radius => r, :side => :left)
pdf.quarter_circle([x, y], :radius => r, :quadrant => 3)

The built in prawn magic works:

pdf.stroke_star([x, y], :radius => r)
pdf.fill_star([x, y], :radius => r)
pdf.fill_and_stroke_star([x, y], :radius => r)

See the examples directory for further usage examples.

Examples

stars: github.com/downloads/Bluejade/prawn-shapes/star.pdf

arcs and pies: github.com/downloads/Bluejade/prawn-shapes/arc.pdf

Changelog

2009-12-15 - renamed semi_circle to half_circle because it seems more of a kind with quarter_circle

2011-02-14 - fixed syntax for Ruby 1.9. incorporated Bundler

2011-04-05 - added gemspec and published as prawn_shapes. requires Prawn 0.11.1