Skip to content

pradeep-elangovan91/bitmap_editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • Bitmap editor

  • 2D Bitmap editor
  • Documentation

  • Create a new Bitmap
  • You can initialize a new Bitmap by using the command 'I' followed the rows and columns.
  • > 'I 3 3' creates a bitmap of size [3 X 3] with the default colour 'O'.
  • The width and the hight needed to be positive and valid integers, If not "invalid bitmap size ([x],[y])" is displayed.
  • Bitmap Commands
  • You could print or manipulate Bitmap once created by using set of commands.
  • When you try to run the commands without initializing bitmap "Bitmap not yet created" message will be displayed.
  • 1. printBitmap
  • >executed with the command 'S'
  • prints the bitmap row wise
  • starts with a '------start---------' and ends with a '---------end-------'
  • ex S
  • ---start--------
  • P O O O O O O K
  • E J E O O O O K
  • F O O O O O O K
  • -------end--------
  • 2. clearBitmap
  • replaces every pixel with color 'O' the default colour
  • >executed with the command 'C'
  • ----start--------
  • O O O O O O O O
  • O O O O O O O O
  • O O O O O O O O
  • -------end--------
  • 3. drawPixel
  • replaces a colour with a given pixel in a given coordinates
  • >executed with the command **'L x-cooridnate y-coordinate Colour'**
  • ex L 0 0 F replaces bitmap[0][0] to colour F.
  • ----start--------
  • F O O O O O O O
  • O O O O O O O O
  • O O O O O O O O
  • -------end--------
  • 4. drawHorizonatalLine
  • replaces the colour horizontally in an x-coordinate between two different y ranges.
  • >executed with the commands 'H x-coordinate y1-coordinate y2-coordinate Colour'
  • ex H 2 0 3 K
  • ----start--------
  • F O O O O O O O
  • O O O O O O O O
  • K K K K O O O O
  • -------end--------
  • 5. drawVerticalLine
  • replaces the colour verically in an y-coordinate from two different x ranges.
  • >executed with the commands 'V y-coordinate x1-coordinate x2-coordinate Colour'
  • ex V 7 0 3 Z
  • ----start--------
  • F O O O O O O Z
  • O O O O O O O Z
  • K K K K O O O Z
  • -------end--------
  • Running

  • execute below to run the bitmap editor with preentered commands in show.txt
  • >bin/bitmap_editor examples/show.txt
  • Running Test

  • rspec spec/bitmap_editor_spec.rb
  • rspec spec/bitmap_helper_spec.rb
  • rspec spec/bitmap_validator_spec.rb
  • rpsec spec/bitmap_spec.rb

About

A simple 2d bitmap editor in ruby with rspec

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages