Class: Tracksperanto::Tool::Crop

Inherits:
Base
  • Object
show all
Defined in:
lib/tools/crop.rb

Overview

Does the same as the Pad tool but with absolute pixel values instead of fractionals

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods included from Parameters

#parameter, #parameters

Methods included from SimpleExport

#just_export

Methods included from ConstName

#const_name

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Constructor Details

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

Class Method Details

.action_descriptionObject



9
10
11
# File 'lib/tools/crop.rb', line 9

def self.action_description
  "Crop or pad the image by a specified number of pixels"
end

Instance Method Details

#start_export(w, h) ⇒ Object



13
14
15
16
17
# File 'lib/tools/crop.rb', line 13

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::Tool::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