Class: Magick::Draw

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyplot/artist/magick.rb

Instance Method Summary collapse

Instance Method Details

#scale_annotation(img, width, height, x, y, text, scale) ⇒ Object

Method to Scale text annotation in RMagick


5
6
7
8
9
# File 'lib/rubyplot/artist/magick.rb', line 5

def scale_annotation(img, width, height, x, y, text, scale)
  scaled_width = (width * scale) >= 1 ? (width * scale) : 1
  scaled_height = (height * scale) >= 1 ? (height * scale) : 1
  annotate(img, scaled_width.to_i, scaled_height.to_i, (x * scale).to_i, (y * scale).to_i, text.gsub('%', '%%'))
end