Class: RETerm::Components::Image

Inherits:
RETerm::Component show all
Defined in:
lib/reterm/components/image.rb

Overview

Renders and image to the screen using drawille and chunkpng.

Constant Summary

Constants included from LogHelpers

LogHelpers::LOG_FILE

Instance Attribute Summary

Attributes inherited from RETerm::Component

#activatable, #activate_focus, #highlight_focus, #window

Instance Method Summary collapse

Methods inherited from RETerm::Component

#activatable?, #activate!, #activate_focus?, #cdk?, #colored?, #colors=, #deactivate!, #deactivate?, #distance_from, #extra_padding, #finalize!, #highlight_focus?, #reactivate!, #requested_rows, #resize, #sync!, #sync_getch

Methods included from KeyBindings

#bind_key, #invoke_key_bindings, #key_bindings, #key_bound?

Methods included from LogHelpers

#logger

Methods included from EventDispatcher

#dispatch, #handle

Constructor Details

#initialize(args = {}) ⇒ Image

Initialize the Image component

Parameters:

  • args (Hash) (defaults to: {})

    image params

Options Hash (args):

  • :file (String)

    path to the file containing the image



11
12
13
14
# File 'lib/reterm/components/image.rb', line 11

def initialize(args={})
  super
  @file = args[:file]
end

Instance Method Details

#draw!Object



16
17
18
# File 'lib/reterm/components/image.rb', line 16

def draw!
  refresh_win
end

#requeseted_rowsObject



20
21
22
# File 'lib/reterm/components/image.rb', line 20

def requeseted_rows
  image.dimension.height
end

#requested_colsObject



24
25
26
# File 'lib/reterm/components/image.rb', line 24

def requested_cols
  image.dimension.width
end