class Bagel::Graphic::Stats::Duration

Constants

COLOR_BG
COLOR_TEXT
HEIGHT
WIDTH

Public Class Methods

new(minutes) click to toggle source
# File lib/bagel/graphic/stats/duration.rb, line 10
def initialize(minutes)
  @minutes = minutes
end

Public Instance Methods

draw() click to toggle source
# File lib/bagel/graphic/stats/duration.rb, line 14
def draw
  canvas = Image.new(WIDTH, HEIGHT) { |i| i.background_color = COLOR_BG }

  text = Image.new(WIDTH, HEIGHT) { |i| i.background_color = COLOR_BG }

  draw = Magick::Draw.new do |d|
    d.font_family = FONT_FAMILY
    d.pointsize = 32
    d.gravity = Magick::CenterGravity
    d.fill = COLOR_TEXT
  end

  draw.annotate(text, 0, 0, 0, 0, "SET TIME: #{@minutes} MINUTES")
  text.trim!

  canvas.composite!(text, CenterGravity, 0, 0, AtopCompositeOp)
end