Sha256: c37835a4db5c0fd356d14cd20b28c78e102b0f066c2a73e2047a3b6001165067

Contents?: true

Size: 1.11 KB

Versions: 26

Compression:

Stored size: 1.11 KB

Contents

# -*- encoding : utf-8 -*-
# This tool pads the comp or crops it if given negative values. Use it to say unpad
# some fucked-up telecine transfers. The padding is in fractional units of the total width
# and height
class Tracksperanto::Tool::Pad < Tracksperanto::Tool::Base
  
  parameter :top_pad,     :cast => :float, :desc => "Top padding (fraction of original size)"
  parameter :left_pad,    :cast => :float, :desc => "Left padding (fraction of original size)"
  parameter :right_pad,   :cast => :float, :desc => "Right padding (fraction of original size)"
  parameter :bottom_pad,  :cast => :float, :desc => "Bottom padding (fraction of original size)"
  
  def self.action_description
    "Pad or crop the image by a fraction of it's original size"
  end
  
  def start_export(w, h)
    @shift_left, @shift_bottom = w * left_pad, h * bottom_pad
    w_mult = 1 + left_pad + right_pad
    h_mult = 1 + bottom_pad + top_pad
    super((w * w_mult).ceil, (h * h_mult).ceil)
  end
  
  def export_point(frame, float_x, float_y, float_residual)
    super(frame, float_x - @shift_left, float_y - @shift_bottom, float_residual)
  end
  
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
tracksperanto-3.5.9 lib/tools/pad.rb
tracksperanto-3.5.8 lib/tools/pad.rb
tracksperanto-3.5.7 lib/tools/pad.rb
tracksperanto-3.5.6 lib/tools/pad.rb
tracksperanto-3.5.5 lib/tools/pad.rb
tracksperanto-3.5.4 lib/tools/pad.rb
tracksperanto-3.5.2 lib/tools/pad.rb
tracksperanto-3.5.1 lib/tools/pad.rb
tracksperanto-3.5.0 lib/tools/pad.rb
tracksperanto-3.4.1 lib/tools/pad.rb
tracksperanto-3.4.0 lib/tools/pad.rb
tracksperanto-3.3.13 lib/tools/pad.rb
tracksperanto-3.3.12 lib/tools/pad.rb
tracksperanto-3.3.11 lib/tools/pad.rb
tracksperanto-3.3.10 lib/tools/pad.rb
tracksperanto-3.3.9 lib/tools/pad.rb
tracksperanto-3.3.8 lib/tools/pad.rb
tracksperanto-3.3.7 lib/tools/pad.rb
tracksperanto-3.3.6 lib/tools/pad.rb
tracksperanto-3.3.0.pre lib/tools/pad.rb