Class: Skylab::Myterm::ImageBuilder
- Inherits:
-
Object
- Object
- Skylab::Myterm::ImageBuilder
- Defined in:
- lib/myterm/api.rb
Instance Attribute Summary collapse
-
#iterm ⇒ Object
readonly
Returns the value of attribute iterm.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(iterm, lines, opts) ⇒ ImageBuilder
constructor
A new instance of ImageBuilder.
- #run ⇒ Object
Constructor Details
#initialize(iterm, lines, opts) ⇒ ImageBuilder
Returns a new instance of ImageBuilder.
79 80 81 |
# File 'lib/myterm/api.rb', line 79 def initialize iterm, lines, opts @iterm, @lines, @opts = [iterm, lines, opts] end |
Instance Attribute Details
#iterm ⇒ Object (readonly)
Returns the value of attribute iterm.
83 84 85 |
# File 'lib/myterm/api.rb', line 83 def iterm @iterm end |
Class Method Details
.build_background_image(iterm, lines, opts) ⇒ Object
98 99 100 |
# File 'lib/myterm/api.rb', line 98 def build_background_image iterm, lines, opts new(iterm, lines, opts).run end |
Instance Method Details
#run ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/myterm/api.rb', line 85 def run require 'RMagick' bg_color = Color.dup(@iterm.session.background_color) @opts.key?(:alpha_percent) and bg_color.alpha = @opts[:alpha_percent] img = Magick::Image.new(500, 300) do # copying over hard-coded dimensions from original Dmytro script self.background_color = bg_color.to_hex end build_text_drawing img img end |