Class: Bitmapped::Commands::InvertCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/bitmapped/commands/invert_command.rb

Constant Summary collapse

ALPHABET =
[*'A'..'Z']

Instance Method Summary collapse

Instance Method Details

#command_idObject



9
10
11
# File 'lib/bitmapped/commands/invert_command.rb', line 9

def command_id
  "N"
end

#process_command(bitmap, input) ⇒ Object



13
14
15
16
17
18
# 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