Sha256: ef3e2acac2f0d09eea6afb6feccab6c21d1e8df34d9e533c8c55947419167049

Contents?: true

Size: 776 Bytes

Versions: 5

Compression:

Stored size: 776 Bytes

Contents

# encoding: utf-8   

# join_style.rb : Implements stroke join styling
#
# Contributed by Daniel Nelson. October, 2009
#
# This is free software. Please see the LICENSE and COPYING files for details.
#
module Prawn
  module Graphics
    module JoinStyle
      # Sets the join_style for stroked lines and curves
      #

      JOIN_STYLES = { :miter => 0, :round => 1, :bevel => 2 }
      
      # style is one of :miter, :round, or :bevel
      def join_style(style=nil)
        return @join_style || :miter if style.nil?

        @join_style = style

        write_stroke_join_style
      end
      
      alias_method :join_style=, :join_style

      private

      def write_stroke_join_style
        add_content "#{JOIN_STYLES[@join_style]} j"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
prawn-layout-0.3.2 vendor/prawn-core/lib/prawn/graphics/join_style.rb
prawn-core-0.6.3 lib/prawn/graphics/join_style.rb
prawn-core-0.6.2 lib/prawn/graphics/join_style.rb
prawn-layout-0.3.1 vendor/prawn-core/lib/prawn/graphics/join_style.rb
prawn-core-0.6.1 lib/prawn/graphics/join_style.rb