Class: ShatteredMachine::Sampler
- Inherits:
-
Object
- Object
- ShatteredMachine::Sampler
- Defined in:
- lib/shattered_machine/sampler.rb
Overview
A simple weay ro run one, many or all glitch algotirhm on one specific image. This create a quick overview of the effect of each algo for the given image.
Constant Summary collapse
- ALL_ALGORITHMS =
%w[brush change_byte defect exchange slim transpose wrong_filter].freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(io, options = {}) ⇒ Sampler
constructor
A new instance of Sampler.
Constructor Details
#initialize(io, options = {}) ⇒ Sampler
Returns a new instance of Sampler.
12 13 14 15 16 |
# File 'lib/shattered_machine/sampler.rb', line 12 def initialize(io, = {}) @io = io @base_output_filename = io.output_filename.empty? ? 'sample' : io.output_filename @algorithms_to_sample = [:algorithms_to_sample] || ALL_ALGORITHMS end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/shattered_machine/sampler.rb', line 18 def call FILTERS.each do |filter| sample_exchange(filter) sample_transpose(filter) sample_wrong_filter(filter) end sample_slim sample_brush sample_change_byte sample_defect end |