Class: ShatteredMachine::PixelSorter
- Inherits:
-
Object
- Object
- ShatteredMachine::PixelSorter
- Defined in:
- lib/shattered_machine/pixel_sorter.rb
Overview
Sort pixels of a given png image. The logic for the pixel sorter come from the Rusty Engine.
Instance Method Summary collapse
-
#call(input_image, output_image) ⇒ boolean
Status of pixel sort.
-
#initialize(options = {}) ⇒ PixelSorter
constructor
A new instance of PixelSorter.
Constructor Details
#initialize(options = {}) ⇒ PixelSorter
Returns a new instance of PixelSorter.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shattered_machine/pixel_sorter.rb', line 10 def initialize( = {}) @direction = [:direction] || :vertical @smart_sorting = ([:smart_sorting] || true).to_s @detection_type = [:detection_type] || :lightness_range @detection_min = [:detection_min] || '45' @detection_max = [:detection_max] || '60' @multiple_ranges = ([:multiple_ranges] || false).to_s @detection_min_two = [:detection_min_two] || '75' @detection_max_two = [:detection_max_two] || '90' @sorting_by = [:sorting_by] || :hue end |
Instance Method Details
#call(input_image, output_image) ⇒ boolean
Returns status of pixel sort.
25 26 27 28 29 |
# File 'lib/shattered_machine/pixel_sorter.rb', line 25 def call(input_image, output_image) RustyEngine.sort(input_image, output_image, rust_formatted_direction, @smart_sorting, rust_formatted_detection_type, @detection_min, @detection_max, @multiple_ranges, @detection_min_two, @detection_max_two, rust_formatted_sorting_by) end |