Sha256: bc47c3228472e5584332af764233b18c8ccd2a3c5e4fe969f06f309db06f265d

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
#
# The cap style defines how the edge of a line or curve will be drawn. There are
# three types: <code>:butt</code> (the default), <code>:round</code> and
# <code>:projecting_square</code>
#
# The difference is better seen with thicker lines. With <code>:butt</code>
# lines are drawn starting and ending at the exact points provided. With both
# <code>:round</code> and <code>:projecting_square</code> the line is projected
# beyond the start and end points.
#
# Just like <code>line_width=</code> the <code>cap_style=</code> method needs an
# explicit receiver to work.
#
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

  self.line_width = 25

  [:butt, :round, :projecting_square].each_with_index do |cap, i|
    self.cap_style = cap

    y = 250 - i*100
    stroke_horizontal_line 100, 300, :at => y
    stroke_circle [400, y], 15
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

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