Question
Project Assignment (100 points) In this project: You will complete the following tasks. 1. Create a .bmp file, called myBmp.bmp, that stores the 4x3 image
Project Assignment (100 points) 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.
Hi, my question is really, I have made the bitmap file already and have barely started the structure to the code, I have started the file open and file read, but have no idea really how to turn the bitmap into an array then manipulate the data so that it rotates vertically and horizontally. Any guidance will be awesome.
#include
#include
#include
#include
#
#pragma warning(disable: 4996)
int bitmapArr[7][32];
void main () { int n; int count1; int count2; FILE *f =fopen("C:\\Users\\abirutis\\Downloads\\myBMP.bmp", "rb");
fscanf(f,"%d", &n); while (n != EOF) { //do some stuff bitmapArr[][]
//read the next number fscanf(f, "%d", &n); }
fclose(f); }
void loadFile()
{
}
void printArray() { //n printArray to print the hexadecimal numbers stored in the 2D array. }
void printMenu {
printf{""}
while (ans != q) switch case 1: case 2: case 3: case q:
}
void flipHorizonal() { //save to myBMPFlipped1.bmp }
void flipVertical() {
// save to myBMPFlipped2.bmp }
int saveToFile() {
}
void doAll() {
}
HERES THE BITMAP FILE, if you need it
42 4d 66 00 00 00 00 00 00 00 36 00 00 00 28 00 00 00 03 00 00 00 04 00 00 00 01 00 18 00 00 00 00 00 00 00 00 00 c4 0e 00 00 c4 0e 00 00 00 00 00 00 00 00 00 00 00 00 ff ff 00 00 00 ff ff 00 00 00 00 ff 00 00 00 ff ff ff ff 00 00 00 ff 00 00 00 ff ff 00 00 ff 00 00 00 00 00 ff 00 ff 00 ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00
Step 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