class Bagel::Graphic::Scoreboard::Score

Constants

HEIGHT
WIDTH

Public Class Methods

new(value) click to toggle source
# File lib/bagel/graphic/scoreboard/score.rb, line 7
def initialize(value)
  @value = value
end

Public Instance Methods

color_bg() click to toggle source
# File lib/bagel/graphic/scoreboard/score.rb, line 29
def color_bg
  raise 'abstract'
end
color_text() click to toggle source
# File lib/bagel/graphic/scoreboard/score.rb, line 33
def color_text
  raise 'abstract'
end
draw() click to toggle source
# File lib/bagel/graphic/scoreboard/score.rb, line 11
def draw
  text = Image.new(HEIGHT * 2, HEIGHT * 2) { |i| i.background_color = color_bg }

  draw = Magick::Draw.new do |d|
    d.font_family = FONT_FAMILY
    d.font_weight = FONT_WEIGHT
    d.pointsize = FONT_SIZE
    d.gravity = CenterGravity
    d.fill = color_text
  end

  draw.annotate(text, 0, 0, 0, 0, @value.to_s)
  text.trim!

  canvas = Image.new(HEIGHT, HEIGHT) { |i| i.background_color = color_bg }
  canvas.composite!(text, CenterGravity, 0, 0, OverCompositeOp)
end