Sha256: b0e51128b6e9328ee159f0ca33965ae04738c19fd570f62ddda153cc98f8c37d

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

module DotGrid
  module Pattern
    class GridPlusLines < Pattern

      DARK_LINE_WIDTH = 3
      DARK_LINE_SPACING = 3

      def draw_row(row)
        pdf.mask(:line_width) do 
          pdf.line_width (row % DARK_LINE_SPACING == 0) ? DARK_LINE_WIDTH : pdf.line_width 
          pdf.stroke_horizontal_line(0, bounds.width, :at => row*spacing) 
        end 
      end

      def draw_column(column)
        pdf.stroke_vertical_line(0, bounds.height, :at => column*spacing)
      end

      def draw
        pdf.stroke_color grid_color
        draw_grid do |row, column|
          draw_row(row) if column == 0
          draw_column(column) if row == 0
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dot_grid-0.0.12 lib/dot_grid/pattern/grid_plus_lines.rb
dot_grid-0.0.11 lib/dot_grid/pattern/grid_plus_lines.rb