Sha256: 73cc95cbd9408cf07873692a8f19c3a81aaf9d68c8e6d0eecdcaa21ff8ab1907

Contents?: true

Size: 812 Bytes

Versions: 8

Compression:

Stored size: 812 Bytes

Contents

# encoding: utf-8
#
# This transformation is used to rotate the user space. Give it an angle
# and an <code>:origin</code> point about which to rotate and a block.
# Everything inside the block will be drawn with the rotated coordinates.
#
# The angle is in degrees.
#
# If you omit the <code>:origin</code> option the page origin will be used.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
  stroke_axis
  
  fill_circle [250, 200], 2
  
  12.times do |i|
    
    rotate(i * 30, :origin => [250, 200]) do
      
      stroke_rectangle [350, 225], 100, 50
      draw_text "Rotated #{i * 30}°", :size => 10, :at => [360, 205]
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-1.0.0 manual/graphics/rotate.rb
prawn-0.15.0 manual/graphics/rotate.rb
prawn-0.14.0 manual/graphics/rotate.rb
prawn-0.13.2 manual/graphics/rotate.rb
prawn-0.13.1 manual/graphics/rotate.rb
prawn-0.13.0 manual/graphics/rotate.rb
prawn-1.0.0.rc2 manual/graphics/rotate.rb
nurettin-prawn-1.0.0.rc1 manual/graphics/rotate.rb