Question
In this project: You will complete the following tasks. 1. Create a .bmp file, called myBmp.bmp , that stores the 4x3 image shown in Figure
In this project: You will complete the following tasks.
1. Create a .bmp file, called myBmp.bmp, that stores the 4x3 image shown in Figure 4, where the 24-bit color code marked in each component. You must calculate the number of padding bytes required in each row. Submit the memory map that is similar to Figure 3, but contains the data given in Figure 4. Hint: You can use a Hex Editor to create the .bmp file. [10 points]
2. Write a C program to implement the following functions.
2.1. Include required libraries and define required variables and define a 2D array to store the data loaded from the file; [5 points]
2.2. Write a function loadFile(myBmp) to read a .bmp file and store them into an 2D array of integers; [10 points]
2.3. Write a function printMenu to print a menu for users to choose one of the following functions and call the function; The program must include a q option to exit the program. [10 points]
2.4. Write a function printArray to print the hexadecimal numbers stored in the 2D array. You can use %x control character in printf; [10 points]
2.5. Write a function flipHorizonal to flip the image horizontally and save the data into a new file called myBMPFlipped1.bmp; [10 points]
2.6. Write a function flipVertical to flip the image vertically and save the data into a new file called myBMPFlipped2.bmp. [10 points]
2.7. Write a function saveToFile to save the array data (modified through flip operation) into another file. This function should be called by flipHorizonal and flipVertical. [10 points]
2.8. Write a function doAll, which performs the following tasks: [10 points]
i. loadFile(myBmp)
ii. printArray;
iii. flipHorizonal;
iv. loadFile(myBMPFlipped1.bmp)
v. printArray;
vi. flipVertical
vii. loadFile(myBMPFlipped2.bmp)
viii. printArray;
2.9. Write the main function to perform at least the following tasks: [5 points]
i. Call loadFile to load the .bmp file data into the 2D array;
ii. Call printMenu;
iii. Return the menu after performing one function, and quit the program is q is entered.
I already made the bitmap image, but I don't know how to write the C program for part 2.
2 00 00 00 FF FF FF 00 00 FF 00 00 00 FF 00 FF 00 00 FF 00 00 FF 00 00 FF FF 00 Figure 4. A 4x3 image, with the 24 bit color code marled in each component 2 00 00 00 FF FF FF 00 00 FF 00 00 00 FF 00 FF 00 00 FF 00 00 FF 00 00 FF FF 00 Figure 4. A 4x3 image, with the 24 bit color code marled in each componentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started