Module: Skeptick::Sugar::Drawing
- Included in:
- Convert::DslContext, Image::DslContext
- Defined in:
- lib/skeptick/sugar/drawing.rb
Instance Method Summary collapse
- #canvas(string, options = {}) ⇒ Object
- #draw(*args) ⇒ Object
- #font(name) ⇒ Object
- #write(text, options = {}) ⇒ Object
Instance Method Details
#canvas(string, options = {}) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/skeptick/sugar/drawing.rb', line 4 def canvas(string, = {}) if [:size] set '-size', [:size] end set "canvas:#{string}" end |
#draw(*args) ⇒ Object
12 13 14 |
# File 'lib/skeptick/sugar/drawing.rb', line 12 def draw(*args) set '-draw', args.join(' ').shellescape end |
#font(name) ⇒ Object
24 25 26 |
# File 'lib/skeptick/sugar/drawing.rb', line 24 def font(name) set '-font', name.split(/\s/).map(&:capitalize).join('-') end |
#write(text, options = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/skeptick/sugar/drawing.rb', line 16 def write(text, = {}) if [:left] && [:top] opts = "#{options[:left]},#{options[:top]} " end draw "text #{opts}'#{text}'" end |