Sha256: b13900bda195d07dbd9bef5edc4a7407b7e0acbf6d6d0bac60c83626765d65e1

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

require File.dirname(__FILE__) + '/scaler'

# Reformats (scales) the track setup to a specific pixel resolution
class Tracksperanto::Middleware::Reformat < Tracksperanto::Middleware::Scaler
  attr_accessor :width, :height
  
  # Called on export start
  def start_export( img_width, img_height)
    @width ||= img_width
    @height ||= img_height
    
    self.x_factor, self.y_factor = (@width / img_width.to_f), (@height / img_height.to_f)  
    
    super(@width, @height)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracksperanto-1.1.1 lib/middleware/reformat.rb
tracksperanto-1.1.0 lib/middleware/reformat.rb