Class: DotGrid::Pattern::GridPlusLines
- Inherits:
-
Pattern
- Object
- Pattern
- DotGrid::Pattern::GridPlusLines
show all
- Defined in:
- lib/dot_grid/pattern/grid_plus_lines.rb
Constant Summary
collapse
- DARK_LINE_WIDTH =
3
- DARK_LINE_SPACING =
3
Instance Attribute Summary
Attributes inherited from Pattern
#bounds, #grid_color, #pdf
Instance Method Summary
collapse
Methods inherited from Pattern
#columns, #draw_grid, #initialize, #post_initialize, #rows
Instance Method Details
#draw ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/dot_grid/pattern/grid_plus_lines.rb', line 19
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
|
#draw_column(column) ⇒ Object
15
16
17
|
# File 'lib/dot_grid/pattern/grid_plus_lines.rb', line 15
def draw_column(column)
pdf.stroke_vertical_line(0, bounds.height, :at => column*spacing)
end
|
#draw_row(row) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/dot_grid/pattern/grid_plus_lines.rb', line 8
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
|