Class: Tracksperanto::Middleware::Scaler

Inherits:
Base
  • Object
show all
Defined in:
lib/middleware/scaler.rb

Overview

Scales the comp being exported by a specific factor, together with the tracker keyframes

Constant Summary collapse

DEFAULT_FACTOR =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#end_export, #end_tracker_segment, inherited, #initialize, #start_tracker_segment

Methods included from SimpleExport

#just_export

Methods included from ConstName

#const_name, included

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_float, #cast_to_int, #cast_to_string, included

Constructor Details

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

Instance Attribute Details

#x_factorObject

Returns the value of attribute x_factor.



5
6
7
# File 'lib/middleware/scaler.rb', line 5

def x_factor
  @x_factor
end

#y_factorObject

Returns the value of attribute y_factor.



5
6
7
# File 'lib/middleware/scaler.rb', line 5

def y_factor
  @y_factor
end

Instance Method Details

#export_point(frame, float_x, float_y, float_residual) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/middleware/scaler.rb', line 22

def export_point(frame, float_x, float_y, float_residual)
  super(frame, 
    (float_x * x_factor), 
    (float_y * y_factor), 
    (float_residual * @residual_factor)
  )
end

#start_export(img_width, img_height) ⇒ Object

Called on export start



9
10
11
12
# File 'lib/middleware/scaler.rb', line 9

def start_export( img_width, img_height)
  set_residual_factor
  super( (img_width * x_factor).to_i, (img_height * y_factor).to_i)
end