Class: Tracksperanto::Tool::Reformat

Inherits:
Base
  • Object
show all
Defined in:
lib/tools/reformat.rb

Overview

This tool reformats (scales) the track setup to a specific pixel resolution. Very useful for applying proxy tracks to full-res images

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods included from Parameters

#parameter, #parameters

Methods included from SimpleExport

#just_export

Methods included from ConstName

#const_name

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Constructor Details

This class inherits a constructor from Tracksperanto::Tool::Base

Class Method Details

.action_descriptionObject


10
11
12
# File 'lib/tools/reformat.rb', line 10

def self.action_description
  "Reformat the comp together with it's trackers to conform to a specific format"
end

Instance Method Details

#start_export(img_width, img_height) ⇒ Object

Called on export start


15
16
17
18
19
20
21
22
23
24
# File 'lib/tools/reformat.rb', line 15

def start_export( img_width, img_height)
  @width ||= img_width # If they be nil
  @height ||= img_height
  
  x_factor, y_factor = (@width / img_width.to_f), (@height / img_height.to_f)  
  
  @stash = @exporter
  @exporter = Tracksperanto::Tool::Scaler.new(@exporter, :x_factor => x_factor, :y_factor => y_factor)
  super
end