class Bitmapped::Commands::InvertCommand
Constants
- ALPHABET
Public Instance Methods
command_id()
click to toggle source
# File lib/bitmapped/commands/invert_command.rb, line 9 def command_id "N" end
process_command(bitmap, input)
click to toggle source
# File lib/bitmapped/commands/invert_command.rb, line 13 def process_command(bitmap, input) Validators::ValidateBitmapInitialised.parse_and_validate(bitmap) bitmap.pixels.each_with_index do |row, index| bitmap.pixels[index] = row.collect{ |color| invert_color(color) } end end
Private Instance Methods
invert_color(color)
click to toggle source
# File lib/bitmapped/commands/invert_command.rb, line 21 def invert_color(color) ALPHABET[-(ALPHABET.index(color)+1)] end