class MovieMasher::Graph

top level interface

Public Class Methods

color_value(color) click to toggle source
# File lib/graph.rb, line 37
def self.color_value(color)
  if color.is_a?(String) && color.end_with?(')') && color.start_with?(
    'rgb(', 'rgba('
  )
    color_split = color.split('(')
    method = color_split.shift.to_sym
    params = color_split.shift[0..-2]
    color = FilterHelpers.send(method, params)
  end
  color
end
new(job = nil, job_input = nil, render_range = nil) click to toggle source
Calls superclass method
# File lib/graph.rb, line 90
def initialize(job = nil, job_input = nil, render_range = nil)
  super()
  @job = job
  @job_input = job_input
  @render_range = render_range
end

Public Instance Methods

create_layer(input) click to toggle source
# File lib/graph.rb, line 49
def create_layer(input)
  raise('no job') unless @job

  __raise_unless(input[:type], "input with no type #{input}")
  case input[:type]
  when Type::VIDEO
    layer = LayerRawVideo.new(input, @job_input)
  when Type::TRANSITION
    layer = LayerTransition.new(@job, input, @job_input)
  when Type::IMAGE
    layer = LayerRawImage.new(input, @job_input)
  when Type::THEME
    layer = LayerTheme.new(input, @job_input)
  else
    raise(Error::JobInput, "input hash type invalid #{input}")
  end
  layer
end
duration() click to toggle source
# File lib/graph.rb, line 68
def duration
  @render_range.length_seconds
end
graph_command(output) click to toggle source
# File lib/graph.rb, line 72
def graph_command(output)
  FilterSourceRaw.input_index = 0
  @job_output = output
end
graph_scope() click to toggle source
# File lib/graph.rb, line 77
def graph_scope
  raise('no job') unless @job

  scope = {}
  scope[:mm_job] = @job
  scope[:mm_output] = @job_output
  scope[:mm_render_range] = @render_range
  scope[:mm_fps] = @job_output[:video_rate] || 1
  scope[:mm_dimensions] = @job_output[:dimensions]
  scope[:mm_width], scope[:mm_height] = scope[:mm_dimensions].split 'x'
  scope
end
inputs() click to toggle source
# File lib/graph.rb, line 97
def inputs
  []
end