Permalink
Browse files

padding for sheet added

  • Loading branch information...
1 parent f4f7966 commit 52610a84bae353e183006939e8a9b17e180faae6 @c-lehmann committed Jan 22, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 generator/lib/groszherd.rb
View
@@ -69,6 +69,8 @@ def delta_diameter_innersquare
class Sheet
+ PADDING = 100
+
attr_reader :button
include Magick
@@ -84,20 +86,20 @@ def initialize year = Time.now.year
def image
rows.times do |row|
columns.times do |col|
- x = col * (@button.image.columns + Button::PADDING)
- y = row * (@button.image.rows + Button::PADDING)
+ x = col * (@button.image.columns + Button::PADDING) + PADDING
+ y = row * (@button.image.rows + Button::PADDING) + PADDING
@canvas.composite! @button.image.clone, x, y, Magick::AddCompositeOp
end
end
@canvas
end
def columns
- @canvas.columns / (@button.image.columns + Button::PADDING)
+ (@canvas.columns - PADDING * 2) / (@button.image.columns + Button::PADDING)
end
def rows
- @canvas.rows / (@button.image.rows + Button::PADDING)
+ (@canvas.rows - PADDING * 2) / (@button.image.rows + Button::PADDING)
end
end

0 comments on commit 52610a8

Please sign in to comment.