Sha256: b5ff14683c51a37bdc7c55e1fee9c8db2f21cd0d11d9057289a0fce4876ad9fa

Contents?: true

Size: 796 Bytes

Versions: 6

Compression:

Stored size: 796 Bytes

Contents

# encoding: utf-8
#
# This transformation is used to translate the user space. Just provide the
# x and y coordinates for the new origin.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  stroke_axis

  1.upto(3) do |i|

    x = i * 50
    y = i * 100
    translate(x, y) do

      # Draw a point on the new origin
      fill_circle [0, 0], 2
      draw_text "New origin after translation to [#{x}, #{y}]",
                :at => [5, -2], :size => 8

      stroke_rectangle [100, 75], 100, 50
      text_box "Top left corner at [100,75]",
                :at => [110, 65], :width => 80, :size => 8
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
prawn-git-2.0.1 manual/graphics/translate.rb
prawn-2.0.1 manual/graphics/translate.rb
prawn-2.0.0 manual/graphics/translate.rb
prawn-1.3.0 manual/graphics/translate.rb
prawn-1.2.1 manual/graphics/translate.rb
prawn-1.1.0 manual/graphics/translate.rb