Sha256: 09e4fe99d02ff50e75c131982d22f28c2fa8837b03f42f02b978dc977aca975f

Contents?: true

Size: 876 Bytes

Versions: 16

Compression:

Stored size: 876 Bytes

Contents

# encoding: utf-8   

# cap_style.rb : Implements stroke cap 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 CapStyle

      CAP_STYLES = { :butt => 0, :round => 1, :projecting_square => 2 }
      
      # Sets the cap style for stroked lines and curves
      #
      # style is one of :butt, :round, or :projecting_square
      #
      # NOTE: If this method is never called, :butt will be used by default.
      #
      def cap_style(style=nil)
        return @cap_style || :butt if style.nil?

        @cap_style = style

        write_stroke_cap_style
      end
      
      alias_method :cap_style=, :cap_style

      private

      def write_stroke_cap_style
        add_content "#{CAP_STYLES[@cap_style]} J"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 7 rubygems

Version Path
davebenvenuti-prawn-0.11.1.pre lib/prawn/graphics/cap_style.rb
piglop-prawn-0.10.2.3 lib/prawn/graphics/cap_style.rb
piglop-prawn-0.10.2.2 lib/prawn/graphics/cap_style.rb
piglop-prawn-0.10.2.1 lib/prawn/graphics/cap_style.rb
prawn-0.11.1.pre lib/prawn/graphics/cap_style.rb
goodwill-prawn-edge-0.10.0 lib/prawn/graphics/cap_style.rb
alphasights-prawn-0.10.4 lib/prawn/graphics/cap_style.rb
alphasights-prawn-0.10.3 lib/prawn/graphics/cap_style.rb
alphasights-prawn-0.10.2 lib/prawn/graphics/cap_style.rb
alphasights-prawn-0.10.1 lib/prawn/graphics/cap_style.rb
alphasights-prawn-0.10.0 lib/prawn/graphics/cap_style.rb
prawn-core-0.8.4 lib/prawn/graphics/cap_style.rb
prawn-graph-0.0.2 vendor/prawn-core/lib/prawn/graphics/cap_style.rb
prawn-graph-0.0.1 vendor/prawn-core/lib/prawn/graphics/cap_style.rb
prawn-core-0.7.2 lib/prawn/graphics/cap_style.rb
prawn-core-0.7.1 lib/prawn/graphics/cap_style.rb