Class: ShatteredMachine::Brush
- Inherits:
-
Object
- Object
- ShatteredMachine::Brush
- Defined in:
- lib/shattered_machine/brush.rb
Overview
Brush pixels of a given png image. The logic for the brush come from the Rusty Engine.
Instance Method Summary collapse
-
#call(input_image, output_image) ⇒ boolean
Status of brush.
-
#initialize(options = {}) ⇒ Brush
constructor
A new instance of Brush.
Constructor Details
#initialize(options = {}) ⇒ Brush
Returns a new instance of Brush.
10 11 12 13 14 15 |
# File 'lib/shattered_machine/brush.rb', line 10 def initialize( = {}) @direction = [:direction] || :horizontal_inverted @probability = ([:probability] || 18).to_s @min_pixels = ([:min_pixels] || 1).to_s @max_pixels = ([:max_pixels] || 10).to_s end |
Instance Method Details
#call(input_image, output_image) ⇒ boolean
Returns status of brush.
20 21 22 23 24 25 26 |
# File 'lib/shattered_machine/brush.rb', line 20 def call(input_image, output_image) ruby_to_rust_directions = { horizontal: '1', vertical: '2', horizontal_inverted: '3', vertical_inverted: '4' } RustyEngine.brush(input_image, output_image, @probability, @min_pixels, @max_pixels, ruby_to_rust_directions[@direction]) end |