Sha256: 6d55a05761ab8ff11f20688bed4ff3123ea6bf3419853468dbcfeaaa9fcafda3

Contents?: true

Size: 810 Bytes

Versions: 20

Compression:

Stored size: 810 Bytes

Contents

# encoding: utf-8
#
# Stroke dashing can be applied to any line or curve

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

Prawn::Document.generate("stroke_cap_and_join.pdf") do
  self.line_width = 25
  x0 = bounds.left + 100
  x1 = bounds.left + 200
  x2 = bounds.left + 300

  y = bounds.top - 125

  3.times do |i|
    case i
    when 0
      self.join_style = :miter
    when 1
      self.join_style = :round
    when 2
      self.join_style = :bevel
    end
    stroke do
      move_to(x0, y)
      line_to(x1, y + 100)
      line_to(x2, y)
    end
    y -= 100
  end
  

  3.times do |i|
    case i
    when 0
      self.cap_style = :butt
    when 1
      self.cap_style = :round
    when 2
      self.cap_style = :projecting_square
    end
    stroke_line([x0, y, x2, y])
    y -= 30
  end
end

Version data entries

20 entries across 20 versions & 7 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/graphics/stroke_cap_and_join.rb
piglop-prawn-0.10.2.2 examples/graphics/stroke_cap_and_join.rb
piglop-prawn-0.10.2.1 examples/graphics/stroke_cap_and_join.rb
prawn-0.11.1.pre examples/graphics/stroke_cap_and_join.rb
goodwill-prawn-edge-0.10.0 examples/graphics/stroke_cap_and_join.rb
alphasights-prawn-0.10.4 examples/graphics/stroke_cap_and_join.rb
alphasights-prawn-0.10.3 examples/graphics/stroke_cap_and_join.rb
alphasights-prawn-0.10.2 examples/graphics/stroke_cap_and_join.rb
alphasights-prawn-0.10.1 examples/graphics/stroke_cap_and_join.rb
alphasights-prawn-0.10.0 examples/graphics/stroke_cap_and_join.rb
prawn-core-0.8.4 examples/graphics/stroke_cap_and_join.rb
prawn-graph-0.0.2 vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb
prawn-graph-0.0.1 vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb
prawn-core-0.7.2 examples/graphics/stroke_cap_and_join.rb
prawn-core-0.7.1 examples/graphics/stroke_cap_and_join.rb
prawn-layout-0.3.2 vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb
prawn-core-0.6.3 examples/graphics/stroke_cap_and_join.rb
prawn-core-0.6.2 examples/graphics/stroke_cap_and_join.rb
prawn-layout-0.3.1 vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb
prawn-core-0.6.1 examples/graphics/stroke_cap_and_join.rb