Class: Bagel::Graphic::Stats::Header
- Inherits:
-
Object
- Object
- Bagel::Graphic::Stats::Header
- Defined in:
- lib/bagel/graphic/stats/header.rb
Constant Summary collapse
- WIDTH =
Stats::WIDTH
- HEIGHT =
90
- COLOR_BG =
COLOR_GREY
- COLOR_TEXT =
COLOR_WHITE
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(set_number) ⇒ Header
constructor
A new instance of Header.
Constructor Details
#initialize(set_number) ⇒ Header
Returns a new instance of Header.
10 11 12 |
# File 'lib/bagel/graphic/stats/header.rb', line 10 def initialize(set_number) @set_number = set_number end |
Instance Method Details
#draw ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bagel/graphic/stats/header.rb', line 14 def draw text = Image.new(WIDTH, HEIGHT) { |i| i.background_color = COLOR_BG } draw = Magick::Draw.new do |d| d.font_family = FONT_FAMILY d.pointsize = 36 d.gravity = Magick::CenterGravity d.fill = COLOR_TEXT end draw.annotate(text, 0, 0, 0, 0, "SET #{@set_number} SUMMARY") text.trim! canvas = Image.new(WIDTH, HEIGHT) { |i| i.background_color = COLOR_BG } canvas.composite!(text, CenterGravity, 0, 0, OverCompositeOp) end |