Sha256: bd378c0ec785f90341f9442ecf8b5e6024846ebc23c915ae9f8b0070a4cf6821

Contents?: true

Size: 638 Bytes

Versions: 7

Compression:

Stored size: 638 Bytes

Contents

class Tracksperanto::Middleware::Scaler < Tracksperanto::Middleware::Base
  DEFAULT_FACTOR = 1
  
  attr_accessor :x_factor, :y_factor
  
  # Called on export start
  def start_export( img_width, img_height)
    # Compute the average factor
    @residual_factor = (x_factor + y_factor) / 2
    super( (img_width * x_factor), (img_height * y_factor))
  end
  
  def y_factor
    @y_factor || DEFAULT_FACTOR
  end
  
  def x_factor
    @x_factor || DEFAULT_FACTOR
  end
  
  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tracksperanto-1.1.1 lib/middleware/scaler.rb
tracksperanto-1.1.0 lib/middleware/scaler.rb
tracksperanto-1.0.6 lib/middleware/scaler.rb
tracksperanto-1.0.4 lib/middleware/scaler.rb
tracksperanto-1.0.2 lib/middleware/scaler.rb
tracksperanto-1.0.1 lib/middleware/scaler.rb
tracksperanto-1.0.0 lib/middleware/scaler.rb