Sha256: 1e29da864c5acff1d8b373b30c1eb1f3b82ea9ec68357277e8deb9b8dfb4089b
Contents?: true
Size: 813 Bytes
Versions: 6
Compression:
Stored size: 813 Bytes
Contents
# -*- encoding : utf-8 -*- # Does the same as the Pad middleware but with absolute pixel values instead of fractionals class Tracksperanto::Middleware::Crop < Tracksperanto::Middleware::Base attr_accessor :top, :left, :right, :bottom cast_to_int :top, :left, :right, :bottom def start_export(w, h) left_pad, right_pad, top_pad, bottom_pad = (left / w.to_f), (right / w.to_f), (top / h.to_f), (bottom / h.to_f) @pad = Tracksperanto::Middleware::Pad.new(@exporter, :left_pad => left_pad, :right_pad => right_pad, :top_pad => top_pad, :bottom_pad => bottom_pad) @pad.start_export(w, h) end # Redirect all method calls to @pad instead of @exporter %w( start_tracker_segment end_tracker_segment export_point end_export).each do | m | define_method(m){|*a| @pad.send(m, *a)} end end
Version data entries
6 entries across 6 versions & 1 rubygems