Sha256: 6918c636b81d7883119f2c2dd911c060d6473f0bcc0fa817bc6b234e2a6ec76a

Contents?: true

Size: 979 Bytes

Versions: 10

Compression:

Stored size: 979 Bytes

Contents

# -*- encoding : utf-8 -*-
require File.dirname(__FILE__) + '/scaler'

# This middleware reformats (scales) the track setup to a specific pixel resolution. Very useful for
# applying proxy tracks to full-res images
class Tracksperanto::Middleware::Reformat < Tracksperanto::Middleware::Base
  
  parameter :width,  :cast => :int, :desc => "New comp width in px", :default => 1080
  parameter :height,  :cast => :int, :desc => "New comp height in px", :default => 1080
  
  def self.action_description
    "Reformat the comp together with it's trackers to conform to a specific format"
  end
  
  # Called on export start
  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::Middleware::Scaler.new(@exporter, :x_factor => x_factor, :y_factor => y_factor)
    super
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tracksperanto-2.12.0 lib/middleware/reformat.rb
tracksperanto-2.11.3 lib/middleware/reformat.rb
tracksperanto-2.11.2 lib/middleware/reformat.rb
tracksperanto-2.11.1 lib/middleware/reformat.rb
tracksperanto-2.11.0 lib/middleware/reformat.rb
tracksperanto-2.10.0 lib/middleware/reformat.rb
tracksperanto-2.9.9 lib/middleware/reformat.rb
tracksperanto-2.9.8 lib/middleware/reformat.rb
tracksperanto-2.9.7 lib/middleware/reformat.rb
tracksperanto-2.9.6 lib/middleware/reformat.rb