$29
Introduction
Tonebased ASCII Art is an interesting art form which uses limited ASCII character set as their basic image elements and it was a popular way to print large graphics posters from dot matrix printers back in the old days but it still remains a popular art form. In this assignment, you are required to complete two small programs, the first one (inverse.cpp)converts tonebased ASCII Art into grayscale bitmap in .BMP format and the second one (ascii.cpp)converts regular RGB bitmap into ASCII art.
into
General Requirements
1. Program must be coded in ANSI C/C++, no additional libraries allowed.
2. The compiled programs must run in Windowscommand prompt as a console program and accepts input with the following syntax.
C:\> inverse <art.txt> <art.bmp>
inverseis your program executable
<art.txt>is the full path name to the given ASCII art file <art.bmp>is the full path name for the output bitmap
1
3. A simple .bmpfile library is included in the package ( bmp.hand bmp.cpp).
4. You may assume input ASCII art or bitmap has size not bigger than 100 x 100.
5. You are required to submit source code only.We will use Visual Studio 2010 C++ compiler and have your program compiled via visual studio command prompt with the following command line.
Please make sure your source code gets compiled well with it, ‘failed to compile’ receives 10point deduction for each failed source.
C:\> cl.exe inverse.cpp bmp.cpp
6. ASCII art and bitmap test files are included for testing your programs.
Part 1 Inverse ASCII Art ( inverse.cpp,60 points )
Complete the program source file inverse.cpp.Your program should process an ASCII art text file and output a grayscale (R, G and B channels have the same value) bitmap in .bmp format. A basic 8level ASCII character set is defined in inverse.cpp.and remember R,G and B of bitmaps can take values from 0255 (unsigned chardata type).
ASCII art file format:
<width> <height>
• row 0 ASCII characters >
• row 1 ASCII characters >
...
...
...
...
• row height-1 ASCII characters >
Example:
10 8
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
*#*#*#*#*#
2
Part 2 ASCII Art Generation ( ascii.cpp,40 points )
Complete the program source file ascii.cpp.Your program should process a given RGB bitmap file in .bmpformat and produce an ASCII art file with the file format given in Part 1. You have to convert RGB into grayscale by using the following formula:
Gray = 0.299 * R + 0.587 * G + 0.114 * B;
Grayscale value should then be quantized into 8 levels properly. The same 8level ASCII character set used in part 1 should be used to produce your result.
into
Bonus Part (10 points)
You are encouraged to implement the following enhancement plus some features that you find interesting and put this bonuspart program into its own standalone source file named
bonus.cpp
• Convert a given RGB bitmap into a ColoredASCII ArtHTML page for web browser ( Try to use CSS style to minimize the size of the HTML !! ) with your own ASCII character set. Be creative !
Submission (Deadline : Feb. 16, 2016 11:59pm )
We expect the following files zipped into a file named by your CWEM (e.g. s1234567890.zip)
and have it uploaded to the course’s elearn page by due date : Feb. 16, 2016 (11:59pm)
• README.TXT(Tell us what to pay attention to, especially about the bonus part)
• inverse.cpp(Part 1 source code )
• ascii.cpp(Part 2 source code )
• bonus.cpp(OPTIONAL, bonus part source code )
3