Sha256: 5c82880f7ba47c2968bdbc119bb83ac5a21df3e2f2d4f31ebfbaed72508dbd56

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

module DotGrid
  module Pattern
    class DotDash < Pattern
      attr_accessor(
        :dot_weight,
      )

      POST_DOT_SPACING = 0.2
      TO_LENGTH = 1.0 - POST_DOT_SPACING

      def post_initialize(params)
        @dot_weight = params[:dot_weight] || 1.5
      end

      def draw
        pdf.line_width @dot_weight
        pdf.fill_color grid_color
        pdf.stroke_color grid_color
        draw_grid do |row, column|
          pdf.fill_circle [column*spacing, row*spacing], dot_weight
          pdf.stroke_horizontal_line(column*spacing+POST_DOT_SPACING*spacing, column*spacing+spacing*TO_LENGTH, :at => row*spacing) 
          pdf.stroke_vertical_line(row*spacing+POST_DOT_SPACING*spacing, row*spacing+spacing*TO_LENGTH, :at => column*spacing) 
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dot_grid-0.0.12 lib/dot_grid/pattern/dot_dash.rb