Class: Bitmapped::Bitmap
- Inherits:
-
Object
- Object
- Bitmapped::Bitmap
- Defined in:
- lib/bitmapped/bitmap.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#pixels ⇒ Object
Returns the value of attribute pixels.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
9 10 11 |
# File 'lib/bitmapped/bitmap.rb', line 9 def columns @columns end |
#pixels ⇒ Object
Returns the value of attribute pixels.
9 10 11 |
# File 'lib/bitmapped/bitmap.rb', line 9 def pixels @pixels end |
#rows ⇒ Object
Returns the value of attribute rows.
9 10 11 |
# File 'lib/bitmapped/bitmap.rb', line 9 def rows @rows end |
#table ⇒ Object
Returns the value of attribute table.
9 10 11 |
# File 'lib/bitmapped/bitmap.rb', line 9 def table @table end |
Instance Method Details
#command(input) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bitmapped/bitmap.rb', line 11 def command(input) begin case input.shift when "I" Commands::InitialiserCommand.new.process_command(self, input) when "X", "exit" Commands::ExitCommand.new.process_command(self, input) when "C" Commands::ClearCommand.new.process_command(self, input) when "L" Commands::PixelFillCommand.new.process_command(self, input) when "V" Commands::VerticalLineCommand.new.process_command(self, input) when "H" Commands::HorizontalLineCommand.new.process_command(self, input) when "F" Commands::FillCommand.new.process_command(self, input) when "S" Commands::PrintTableCommand.new.process_command(self, input) when "T" Commands::PrintFancyTableCommand.new.process_command(self, input) when "R" Commands::RotateCommand.new.process_command(self, input) when "M" Commands::MirrorCommand.new.process_command(self, input) when "N" Commands::InvertCommand.new.process_command(self, input) else "Invalid Command" end rescue BitmapNotInitialised => bni "Bitmap has not been initialised, run command 'I' with valid arguments" rescue ParsingError => pe "Invalid parameters" rescue InvalidCoordinatesError => ice "Invalid co-ordinates" end end |